diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 30fc3789dc50..dfa9ccc7a6cb 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1509,7 +1509,7 @@ void CodeTextEditor::_set_show_warnings_panel(bool p_show) { } void CodeTextEditor::_toggle_scripts_pressed() { - toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel(this) ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons")); + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->toggle_scripts_panel() ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons")); } void CodeTextEditor::_error_pressed(const Ref &p_event) { @@ -1527,9 +1527,7 @@ void CodeTextEditor::_notification(int p_what) { emit_signal("load_theme_settings"); } break; case NOTIFICATION_THEME_CHANGED: { - if (toggle_scripts_button->is_visible()) { - update_toggle_scripts_button(); - } + toggle_scripts_button->set_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? get_icon("Back", "EditorIcons") : get_icon("Forward", "EditorIcons")); _update_font(); } break; case NOTIFICATION_ENTER_TREE: { @@ -1700,8 +1698,7 @@ CodeTextEditor::CodeTextEditor() { toggle_scripts_button = memnew(ToolButton); toggle_scripts_button->connect("pressed", this, "_toggle_scripts_pressed"); status_bar->add_child(toggle_scripts_button); - toggle_scripts_button->set_tooltip(TTR("Toggle Scripts Panel") + " (" + ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text() + ")"); - toggle_scripts_button->hide(); + toggle_scripts_button->set_shortcut(ED_SHORTCUT("script_editor/toggle_scripts_panel", TTR("Toggle Scripts Panel"), KEY_MASK_CMD | KEY_BACKSLASH)); // Error ScrollContainer *scroll = memnew(ScrollContainer); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 54b9cf063017..be6f45e75a17 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -987,11 +987,8 @@ Array ScriptEditor::_get_open_scripts() const { return ret; } -bool ScriptEditor::toggle_scripts_panel(CodeTextEditor *p_editor) { +bool ScriptEditor::toggle_scripts_panel() { list_split->set_visible(!list_split->is_visible()); - if (p_editor) { - p_editor->update_toggle_scripts_button(); - } return list_split->is_visible(); } @@ -1140,16 +1137,7 @@ void ScriptEditor::_menu_option(int p_option) { debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(DEBUG_WITH_EXTERNAL_EDITOR), debug_with_external_editor); } break; case TOGGLE_SCRIPTS_PANEL: { - if (current) { - CodeTextEditor *code_editor = NULL; - ScriptTextEditor *editor = dynamic_cast(current); - if (editor) { - code_editor = editor->code_editor; - } - toggle_scripts_panel(code_editor); - } else { - toggle_scripts_panel(NULL); - } + toggle_scripts_panel(); } } @@ -3327,9 +3315,6 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { file_menu->get_popup()->add_separator(); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/run_file", TTR("Run"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_X), FILE_RUN); - - file_menu->get_popup()->add_separator(); - file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/toggle_scripts_panel", TTR("Toggle Scripts Panel"), KEY_MASK_CMD | KEY_BACKSLASH), TOGGLE_SCRIPTS_PANEL); file_menu->get_popup()->connect("id_pressed", this, "_menu_option"); script_search_menu = memnew(MenuButton); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index e40d596be77e..e2fd67676bf2 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -419,7 +419,7 @@ class ScriptEditor : public PanelContainer { public: static ScriptEditor *get_singleton() { return script_editor; } - bool toggle_scripts_panel(CodeTextEditor *p_editor); + bool toggle_scripts_panel(); bool is_scripts_panel_toggled(); void ensure_focus_current(); void apply_scripts() const;