Browse Source

preserve scripts panel visibility state between sessions in project metadata

hiding script's panel, helps some users to conserve more space for code text.
this fix remembers script's panel visibility state in project's metadata and restore it on editor start.
Thanks to this, users who never use it and are forced to close it each time editor starts, may close it just once and it will stay like this on next sessions until manually opened again.
Avril 5 years ago
parent
commit
f07498a193
1 changed files with 2 additions and 0 deletions
  1. 2 0
      editor/plugins/script_editor_plugin.cpp

+ 2 - 0
editor/plugins/script_editor_plugin.cpp

@@ -992,6 +992,7 @@ Array ScriptEditor::_get_open_scripts() const {
 
 
 bool ScriptEditor::toggle_scripts_panel() {
 bool ScriptEditor::toggle_scripts_panel() {
 	list_split->set_visible(!list_split->is_visible());
 	list_split->set_visible(!list_split->is_visible());
+	EditorSettings::get_singleton()->set_project_metadata("scripts_panel", "show_scripts_panel", list_split->is_visible());
 	return list_split->is_visible();
 	return list_split->is_visible();
 }
 }
 
 
@@ -3223,6 +3224,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
 	overview_vbox->set_v_size_flags(SIZE_EXPAND_FILL);
 	overview_vbox->set_v_size_flags(SIZE_EXPAND_FILL);
 
 
 	list_split->add_child(overview_vbox);
 	list_split->add_child(overview_vbox);
+	list_split->set_visible(EditorSettings::get_singleton()->get_project_metadata("scripts_panel", "show_scripts_panel", true));
 	buttons_hbox = memnew(HBoxContainer);
 	buttons_hbox = memnew(HBoxContainer);
 	overview_vbox->add_child(buttons_hbox);
 	overview_vbox->add_child(buttons_hbox);