diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index a0251936bd1..98cc198d943 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -192,6 +192,18 @@ void EditorNode::_unhandled_input(const InputEvent& p_event) { case KEY_F6: _menu_option_confirm(RUN_PLAY_SCENE,true); break; //case KEY_F7: _menu_option_confirm(RUN_PAUSE,true); break; case KEY_F8: _menu_option_confirm(RUN_STOP,true); break; + case KEY_F11: { + if (p_event.key.mod.shift) { + if (p_event.key.mod.control) { + set_distraction_free_mode(!get_distraction_free_mode()); + } else if (distraction_free_mode) { + distraction_free_mode = false; + _update_top_menu_visibility(); + } else { + set_docks_visible(!get_docks_visible()); + } + } + } break; } } @@ -4522,32 +4534,59 @@ void EditorNode::_update_dock_slots_visibility() { right_hsplit, }; - for(int i=0;iget_tab_count()) - dock_slot[i]->show(); - else + for(int i=0;ihide(); - - } - - - for(int i=0;iget_tab_count() || dock_slot[i*2+1]->get_tab_count(); - if (in_use) - splits[i]->show(); - else - splits[i]->hide(); - } - - for(int i=0;iis_hidden() && dock_slot[i]->get_tab_count()) { - dock_slot[i]->set_current_tab(0); } + + for(int i=0;ihide(); + } + + right_hsplit->hide(); + bottom_panel->hide(); + } else { + for(int i=0;iget_tab_count()) + dock_slot[i]->show(); + else + dock_slot[i]->hide(); + + } + + + for(int i=0;iget_tab_count() || dock_slot[i*2+1]->get_tab_count(); + if (in_use) + splits[i]->show(); + else + splits[i]->hide(); + } + + for(int i=0;iis_hidden() && dock_slot[i]->get_tab_count()) { + dock_slot[i]->set_current_tab(0); + } + } + bottom_panel->show(); + right_hsplit->show(); } } +void EditorNode::_update_top_menu_visibility() { + if (distraction_free_mode) { + play_cc->hide(); + menu_hb->hide(); + scene_tabs->hide(); + } else { + play_cc->show(); + menu_hb->show(); + scene_tabs->show(); + } +} void EditorNode::_load_docks_from_config(Ref p_layout, const String& p_section) { @@ -4913,6 +4952,31 @@ 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(); +} + +bool EditorNode::get_docks_visible() const { + return docks_visible; +} + +void EditorNode::set_distraction_free_mode(bool p_enter) { + distraction_free_mode = p_enter; + + if (p_enter) { + if (docks_visible) { + set_docks_visible(false); + } + } else { + set_docks_visible(true); + } + _update_top_menu_visibility(); +} + +bool EditorNode::get_distraction_free_mode() const { + return distraction_free_mode; +} void EditorNode::add_control_to_dock(DockSlot p_slot,Control* p_control) { ERR_FAIL_INDEX(p_slot,DOCK_SLOT_MAX); @@ -5167,6 +5231,8 @@ EditorNode::EditorNode() { last_checked_version=0; changing_scene=false; _initializing_addons=false; + docks_visible = true; + distraction_free_mode=false; FileAccess::set_backup_save(true); @@ -5632,7 +5698,7 @@ EditorNode::EditorNode() { //s1->set_size(Point2(10,15)); - CenterContainer *play_cc = memnew( CenterContainer ); + play_cc = memnew( CenterContainer ); play_cc->set_ignore_mouse(true); gui_base->add_child( play_cc ); play_cc->set_area_as_parent_rect(); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 5ffd7b964a4..9ad5a085254 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -238,6 +238,7 @@ private: //HSplitContainer *editor_hsplit; //VSplitContainer *editor_vsplit; + CenterContainer *play_cc; HBoxContainer *menu_hb; Control *viewport; MenuButton *file_menu; @@ -351,6 +352,8 @@ private: ToolButton *dock_tab_move_right; int dock_popup_selected; Timer *dock_drag_timer; + bool docks_visible; + bool distraction_free_mode; String _tmp_import_path; @@ -557,7 +560,7 @@ private: void _save_docks_to_config(Ref p_layout, const String& p_section); void _load_docks_from_config(Ref p_layout, const String& p_section); void _update_dock_slots_visibility(); - + void _update_top_menu_visibility(); void _update_layouts_menu(); void _layout_menu_option(int p_idx); @@ -594,6 +597,11 @@ public: void new_inherited_scene() { _menu_option_confirm(FILE_NEW_INHERITED_SCENE,false); } + void set_docks_visible(bool p_show); + bool get_docks_visible() const; + + void set_distraction_free_mode(bool p_enter); + bool get_distraction_free_mode() const; void add_control_to_dock(DockSlot p_slot,Control* p_control); void remove_control_from_dock(Control* p_control);