summaryrefslogtreecommitdiff
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp48
1 files changed, 28 insertions, 20 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index d009ed61b5..d100d7f618 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -3645,6 +3645,7 @@ void EditorNode::_load_docks() {
_load_docks_from_config(config, "docks");
_load_open_scenes_from_config(config, "EditorNode");
+
editor_data.set_plugin_window_layout(config);
}
@@ -3839,6 +3840,23 @@ void EditorNode::_load_open_scenes_from_config(Ref<ConfigFile> p_layout, const S
restoring_scenes = false;
}
+bool EditorNode::has_scenes_in_session() {
+ if (!bool(EDITOR_GET("interface/scene_tabs/restore_scenes_on_load"))) {
+ return false;
+ }
+ Ref<ConfigFile> config;
+ config.instance();
+ Error err = config->load(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("editor_layout.cfg"));
+ if (err != OK) {
+ return false;
+ }
+ if (!config->has_section("EditorNode") || !config->has_section_key("EditorNode", "open_scenes")) {
+ return false;
+ }
+ Array scenes = config->get_value("EditorNode", "open_scenes");
+ return !scenes.empty();
+}
+
void EditorNode::_update_layouts_menu() {
editor_layouts->clear();
@@ -5169,14 +5187,9 @@ EditorNode::EditorNode() {
top_region->add_child(left_menu_hb);
menu_hb->add_child(top_region);
- {
- Control *sp = memnew(Control);
- sp->set_custom_minimum_size(Size2(30, 0) * EDSCALE);
- menu_hb->add_child(sp);
- }
-
file_menu = memnew(MenuButton);
file_menu->set_flat(false);
+ file_menu->set_switch_on_hover(true);
file_menu->set_text(TTR("Scene"));
file_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(file_menu);
@@ -5268,6 +5281,7 @@ EditorNode::EditorNode() {
project_menu = memnew(MenuButton);
project_menu->set_flat(false);
+ project_menu->set_switch_on_hover(true);
project_menu->set_tooltip(TTR("Miscellaneous project or scene-wide tools."));
project_menu->set_text(TTR("Project"));
project_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
@@ -5309,6 +5323,7 @@ EditorNode::EditorNode() {
debug_menu = memnew(MenuButton);
debug_menu->set_flat(false);
+ debug_menu->set_switch_on_hover(true);
debug_menu->set_text(TTR("Debug"));
debug_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(debug_menu);
@@ -5339,6 +5354,7 @@ EditorNode::EditorNode() {
settings_menu = memnew(MenuButton);
settings_menu->set_flat(false);
+ settings_menu->set_switch_on_hover(true);
settings_menu->set_text(TTR("Editor"));
settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(settings_menu);
@@ -5375,6 +5391,7 @@ EditorNode::EditorNode() {
// Help Menu
help_menu = memnew(MenuButton);
help_menu->set_flat(false);
+ help_menu->set_switch_on_hover(true);
help_menu->set_text(TTR("Help"));
help_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
left_menu_hb->add_child(help_menu);
@@ -5391,12 +5408,8 @@ EditorNode::EditorNode() {
p->add_separator();
p->add_icon_item(gui_base->get_icon("Godot", "EditorIcons"), TTR("About"), HELP_ABOUT);
- play_cc = memnew(CenterContainer);
- play_cc->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
- menu_hb->add_child(play_cc);
-
play_button_panel = memnew(PanelContainer);
- play_cc->add_child(play_button_panel);
+ menu_hb->add_child(play_button_panel);
HBoxContainer *play_hb = memnew(HBoxContainer);
play_button_panel->add_child(play_hb);
@@ -5442,11 +5455,6 @@ EditorNode::EditorNode() {
run_native = memnew(EditorRunNative);
play_hb->add_child(run_native);
- native_play_button = memnew(MenuButton);
- native_play_button->set_text("NTV");
- menu_hb->add_child(native_play_button);
- native_play_button->hide();
- native_play_button->get_popup()->connect("id_pressed", this, "_run_in_device");
run_native->connect("native_run", this, "_menu_option", varray(RUN_PLAY_NATIVE));
play_scene_button = memnew(ToolButton);
@@ -5475,6 +5483,9 @@ EditorNode::EditorNode() {
play_custom_scene_button->set_shortcut(ED_SHORTCUT("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F5));
#endif
+ HBoxContainer *right_menu_hb = memnew(HBoxContainer);
+ menu_hb->add_child(right_menu_hb);
+
// Toggle for video driver
video_driver = memnew(OptionButton);
video_driver->set_flat(true);
@@ -5482,7 +5493,7 @@ EditorNode::EditorNode() {
video_driver->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
video_driver->connect("item_selected", this, "_video_driver_selected");
video_driver->add_font_override("font", gui_base->get_font("bold", "EditorFonts"));
- menu_hb->add_child(video_driver);
+ right_menu_hb->add_child(video_driver);
String video_drivers = ProjectSettings::get_singleton()->get_custom_property_info()["rendering/quality/driver/driver_name"].hint_string;
String current_video_driver = OS::get_singleton()->get_video_driver_name(OS::get_singleton()->get_current_video_driver());
@@ -5508,9 +5519,6 @@ EditorNode::EditorNode() {
progress_hb = memnew(BackgroundProgress);
- HBoxContainer *right_menu_hb = memnew(HBoxContainer);
- menu_hb->add_child(right_menu_hb);
-
layout_dialog = memnew(EditorNameDialog);
gui_base->add_child(layout_dialog);
layout_dialog->set_hide_on_ok(false);