summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-03-16 10:53:44 -0700
committerGitHub <noreply@github.com>2019-03-16 10:53:44 -0700
commit376d3dfd03962983668765dd9d7d5905799a62b2 (patch)
tree166fddc2c1e2792990a132f1454b32fd601b52d2
parentd8a6b4ee67c702726e943bbc5779881a9542848b (diff)
parentebabb0ea6598a8b67ec7149e5dea7b036934dde9 (diff)
Merge pull request #27126 from YeldhamDev/bottompanel_hide_only_visible
Make bottom panel only try to hide editors when they're visible
-rw-r--r--editor/editor_node.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 1e03adc219..b8a91589c5 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4232,7 +4232,13 @@ bool EditorNode::are_bottom_panels_hidden() const {
void EditorNode::hide_bottom_panel() {
- _bottom_panel_switch(false, 0);
+ for (int i = 0; i < bottom_panel_items.size(); i++) {
+
+ if (bottom_panel_items[i].control->is_visible()) {
+ _bottom_panel_switch(false, i);
+ break;
+ }
+ }
}
void EditorNode::make_bottom_panel_item_visible(Control *p_item) {
@@ -4269,7 +4275,7 @@ void EditorNode::remove_bottom_panel_item(Control *p_item) {
if (bottom_panel_items[i].control == p_item) {
if (p_item->is_visible_in_tree()) {
- _bottom_panel_switch(false, 0);
+ _bottom_panel_switch(false, i);
}
bottom_panel_vb->remove_child(bottom_panel_items[i].control);
bottom_panel_hb_editors->remove_child(bottom_panel_items[i].button);
@@ -4289,6 +4295,10 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) {
ERR_FAIL_INDEX(p_idx, bottom_panel_items.size());
+ if (bottom_panel_items[p_idx].control->is_visible() == p_enable) {
+ return;
+ }
+
if (p_enable) {
for (int i = 0; i < bottom_panel_items.size(); i++) {
@@ -4309,11 +4319,8 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) {
} else {
bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer"));
- for (int i = 0; i < bottom_panel_items.size(); i++) {
-
- bottom_panel_items[i].button->set_pressed(false);
- bottom_panel_items[i].control->set_visible(false);
- }
+ bottom_panel_items[p_idx].button->set_pressed(false);
+ bottom_panel_items[p_idx].control->set_visible(false);
center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN);
center_split->set_collapsed(true);
bottom_panel_raise->hide();