Merge pull request #68210 from jmb462/3.x-fix-distraction-mode-docks-tab

[3.x] Fix docks to be reset to first tab when switching main tab
This commit is contained in:
Rémi Verschelde 2022-11-09 13:14:28 +01:00
commit 5ea576234f
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 8 additions and 6 deletions

View file

@ -4535,7 +4535,7 @@ void EditorNode::_load_docks() {
editor_data.set_plugin_window_layout(config);
}
void EditorNode::_update_dock_slots_visibility() {
void EditorNode::_update_dock_slots_visibility(bool p_keep_selected_tabs) {
if (!docks_visible) {
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
dock_slot[i]->hide();
@ -4570,9 +4570,11 @@ void EditorNode::_update_dock_slots_visibility() {
}
}
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
if (dock_slot[i]->is_visible() && dock_slot[i]->get_tab_count()) {
dock_slot[i]->set_current_tab(0);
if (!p_keep_selected_tabs) {
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
if (dock_slot[i]->is_visible() && dock_slot[i]->get_tab_count()) {
dock_slot[i]->set_current_tab(0);
}
}
}
@ -5173,7 +5175,7 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) {
void EditorNode::set_docks_visible(bool p_show) {
docks_visible = p_show;
_update_dock_slots_visibility();
_update_dock_slots_visibility(true);
}
bool EditorNode::get_docks_visible() const {

View file

@ -616,7 +616,7 @@ private:
void _load_docks();
void _save_docks_to_config(Ref<ConfigFile> p_layout, const String &p_section);
void _load_docks_from_config(Ref<ConfigFile> p_layout, const String &p_section);
void _update_dock_slots_visibility();
void _update_dock_slots_visibility(bool p_keep_selected_tabs = false);
void _dock_tab_changed(int p_tab);
bool restoring_scenes;