Skip to content

Commit

Permalink
Merge pull request godotengine#79078 from KoBeWi/if_you_gaze_into_the…
Browse files Browse the repository at this point in the history
…_empty_bottom_panel,_the_empty_bottom_panel_gazes_also_into_you

Collapse bottom panel if there is no active tab
  • Loading branch information
YuriSizov authored Jul 10, 2023
2 parents 349e440 + 59ae7e2 commit ef155c1
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5275,21 +5275,29 @@ void EditorNode::_save_central_editor_layout_to_config(Ref<ConfigFile> p_config_
void EditorNode::_load_central_editor_layout_from_config(Ref<ConfigFile> p_config_file) {
// Bottom panel.

if (p_config_file->has_section_key(EDITOR_NODE_CONFIG_SECTION, "center_split_offset")) {
int center_split_offset = p_config_file->get_value(EDITOR_NODE_CONFIG_SECTION, "center_split_offset");
center_split->set_split_offset(center_split_offset);
}

bool has_active_tab = false;
if (p_config_file->has_section_key(EDITOR_NODE_CONFIG_SECTION, "selected_bottom_panel_item")) {
int selected_bottom_panel_item_idx = p_config_file->get_value(EDITOR_NODE_CONFIG_SECTION, "selected_bottom_panel_item");
if (selected_bottom_panel_item_idx >= 0 && selected_bottom_panel_item_idx < bottom_panel_items.size()) {
// Make sure we don't try to open contextual editors which are not enabled in the current context.
if (bottom_panel_items[selected_bottom_panel_item_idx].button->is_visible()) {
_bottom_panel_switch(true, selected_bottom_panel_item_idx);
has_active_tab = true;
}
}
}

if (p_config_file->has_section_key(EDITOR_NODE_CONFIG_SECTION, "center_split_offset")) {
int center_split_offset = p_config_file->get_value(EDITOR_NODE_CONFIG_SECTION, "center_split_offset");
center_split->set_split_offset(center_split_offset);

// If there is no active tab we need to collapse the panel.
if (!has_active_tab) {
bottom_panel_items[0].control->show(); // _bottom_panel_switch() can collapse only visible tabs.
_bottom_panel_switch(false, 0);
}
}

// Debugger tab.

if (p_config_file->has_section_key(EDITOR_NODE_CONFIG_SECTION, "selected_default_debugger_tab_idx")) {
Expand Down

0 comments on commit ef155c1

Please sign in to comment.