diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-06-06 09:22:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-06 09:22:22 +0200 |
commit | 07d4cd7f6d833332b1bc3d2025d222778624ce17 (patch) | |
tree | c9eee6a81b6acd62dd3488dfac084f6beff5aa85 /editor/plugins | |
parent | dd5398ce9dc49d1562faab5504f3923883d461a0 (diff) | |
parent | 69ac6a1f3d6c670155368e34fe39a30ba75ed25d (diff) |
Merge pull request #19388 from volzhs/show-filename
Show opened script or help name
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 20 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.h | 1 |
2 files changed, 17 insertions, 4 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 94dcbd8e18..3c0cc589dc 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1404,16 +1404,16 @@ void ScriptEditor::_update_members_overview_visibility() { ScriptEditorBase *se = _get_current_editor(); if (!se) { - members_overview_buttons_hbox->set_visible(false); + members_overview_alphabeta_sort_button->set_visible(false); members_overview->set_visible(false); return; } if (members_overview_enabled && se->show_members_overview()) { - members_overview_buttons_hbox->set_visible(true); + members_overview_alphabeta_sort_button->set_visible(true); members_overview->set_visible(true); } else { - members_overview_buttons_hbox->set_visible(false); + members_overview_alphabeta_sort_button->set_visible(false); members_overview->set_visible(false); } } @@ -1440,6 +1440,11 @@ void ScriptEditor::_update_members_overview() { members_overview->add_item(functions[i].get_slice(":", 0)); members_overview->set_item_metadata(i, functions[i].get_slice(":", 1).to_int() - 1); } + + String path = se->get_edited_script()->get_path(); + bool built_in = !path.is_resource_file(); + String name = built_in ? path.get_file() : se->get_name(); + filename->set_text(name); } void ScriptEditor::_update_help_overview_visibility() { @@ -1458,8 +1463,9 @@ void ScriptEditor::_update_help_overview_visibility() { } if (help_overview_enabled) { - members_overview_buttons_hbox->set_visible(false); + members_overview_alphabeta_sort_button->set_visible(false); help_overview->set_visible(true); + filename->set_text(se->get_name()); } else { help_overview->set_visible(false); } @@ -2681,6 +2687,12 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { members_overview_buttons_hbox = memnew(HBoxContainer); members_overview_vbox->add_child(members_overview_buttons_hbox); + filename = memnew(Label); + filename->set_clip_text(true); + filename->set_h_size_flags(SIZE_EXPAND_FILL); + filename->add_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal", "LineEdit")); + members_overview_buttons_hbox->add_child(filename); + members_overview_alphabeta_sort_button = memnew(ToolButton); members_overview_alphabeta_sort_button->set_tooltip(TTR("Toggle alphabetical sorting of the method list.")); members_overview_alphabeta_sort_button->set_toggle_mode(true); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index a2ff47cd99..3707f39d11 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -201,6 +201,7 @@ class ScriptEditor : public PanelContainer { ItemList *members_overview; VBoxContainer *members_overview_vbox; HBoxContainer *members_overview_buttons_hbox; + Label *filename; ToolButton *members_overview_alphabeta_sort_button; bool members_overview_enabled; ItemList *help_overview; |