diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 58535ed3eaf5..c92fe27bc5d8 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -196,7 +196,7 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files, // Search for the header at the start offset - standalone PCK file. f->seek(p_offset); uint32_t magic = f->get_32(); - if (magic == PACK_HEADER_MAGIC) { + if (magic == PACK_HEADER_MAGIC || magic == PACK_HEADER_ALTER) { pck_header_found = true; } @@ -213,7 +213,7 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files, for (int i = 0; i < 8; i++) { f->seek(pck_off); magic = f->get_32(); - if (magic == PACK_HEADER_MAGIC) { + if (magic == PACK_HEADER_MAGIC || magic == PACK_HEADER_ALTER) { #ifdef DEBUG_ENABLED print_verbose("PCK header found in executable pck section, loading from offset 0x" + String::num_int64(pck_off - 4, 16)); #endif @@ -236,12 +236,12 @@ bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files, f->seek(f->get_position() - 4); magic = f->get_32(); - if (magic == PACK_HEADER_MAGIC) { + if (magic == PACK_HEADER_MAGIC || magic == PACK_HEADER_ALTER) { f->seek(f->get_position() - 12); uint64_t ds = f->get_64(); f->seek(f->get_position() - ds - 8); magic = f->get_32(); - if (magic == PACK_HEADER_MAGIC) { + if (magic == PACK_HEADER_MAGIC || magic == PACK_HEADER_ALTER) { #ifdef DEBUG_ENABLED print_verbose("PCK header found at the end of executable, loading from offset 0x" + String::num_int64(f->get_position() - 4, 16)); #endif diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h index 1d7b59006bad..34c967e3d491 100644 --- a/core/io/file_access_pack.h +++ b/core/io/file_access_pack.h @@ -38,6 +38,7 @@ // Godot's packed file magic header ("GDPC" in ASCII). #define PACK_HEADER_MAGIC 0x43504447 +#define PACK_HEADER_ALTER 0x25110501 // The current packed file format version number. #define PACK_FORMAT_VERSION 2 diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp index 75870f09b956..17a40f7d3163 100644 --- a/core/io/pck_packer.cpp +++ b/core/io/pck_packer.cpp @@ -89,7 +89,7 @@ Error PCKPacker::pck_start(const String &p_pck_path, int p_alignment, const Stri alignment = p_alignment; - file->store_32(PACK_HEADER_MAGIC); + file->store_32(PACK_HEADER_ALTER); file->store_32(PACK_FORMAT_VERSION); file->store_32(GODOT_VERSION_MAJOR); file->store_32(GODOT_VERSION_MINOR); diff --git a/editor/editor_main_screen.cpp b/editor/editor_main_screen.cpp index fdd4615c33f6..5456620a8f81 100644 --- a/editor/editor_main_screen.cpp +++ b/editor/editor_main_screen.cpp @@ -156,7 +156,7 @@ void EditorMainScreen::select_by_name(const String &p_name) { ERR_FAIL_COND(p_name.is_empty()); for (int i = 0; i < buttons.size(); i++) { - if (buttons[i]->get_text() == p_name) { + if (buttons[i]->get_name() == p_name) { select(i); return; } @@ -242,7 +242,8 @@ void EditorMainScreen::add_main_plugin(EditorPlugin *p_editor) { tb->set_toggle_mode(true); tb->set_theme_type_variation("MainScreenButton"); tb->set_name(p_editor->get_plugin_name()); - tb->set_text(p_editor->get_plugin_name()); + tb->set_tooltip_text(p_editor->get_plugin_name()); + tb->set_icon_alignment(HORIZONTAL_ALIGNMENT_CENTER); Ref icon = p_editor->get_plugin_icon(); if (icon.is_null() && has_theme_icon(p_editor->get_plugin_name(), EditorStringName(EditorIcons))) { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 6b5cc484e4fd..b8d6735c4ebf 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -59,6 +59,7 @@ #include "scene/gui/panel.h" #include "scene/gui/popup.h" #include "scene/gui/rich_text_label.h" +#include "scene/gui/separator.h" #include "scene/gui/split_container.h" #include "scene/gui/tab_container.h" #include "scene/main/window.h" @@ -3571,6 +3572,8 @@ int EditorNode::_next_unsaved_scene(bool p_valid_filename, int p_start) { } void EditorNode::_exit_editor(int p_exit_code) { + DisplayServer::get_singleton()->window_set_mode(DisplayServer::WINDOW_MODE_MINIMIZED); + exiting = true; waiting_for_first_scan = false; resource_preview->stop(); // Stop early to avoid crashes. @@ -4814,7 +4817,7 @@ void EditorNode::_update_recent_scenes() { recent_scenes->clear(); if (rc.size() == 0) { - recent_scenes->add_item(TTRC("No Recent Scenes"), -1); + recent_scenes->add_item(TTR("No Recent Scenes"), -1); recent_scenes->set_item_disabled(-1, true); } else { String path; @@ -7668,32 +7671,10 @@ EditorNode::EditorNode() { top_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); top_split->set_collapsed(true); - VBoxContainer *srt = memnew(VBoxContainer); - srt->set_v_size_flags(Control::SIZE_EXPAND_FILL); - srt->add_theme_constant_override("separation", 0); - top_split->add_child(srt); - - scene_tabs = memnew(EditorSceneTabs); - srt->add_child(scene_tabs); - scene_tabs->connect("tab_changed", callable_mp(this, &EditorNode::_set_current_scene)); - scene_tabs->connect("tab_closed", callable_mp(this, &EditorNode::_scene_tab_closed)); - - distraction_free = memnew(Button); - distraction_free->set_theme_type_variation("FlatMenuButton"); - ED_SHORTCUT_AND_COMMAND("editor/distraction_free_mode", TTRC("Distraction Free Mode"), KeyModifierMask::CTRL | KeyModifierMask::SHIFT | Key::F11); - ED_SHORTCUT_OVERRIDE("editor/distraction_free_mode", "macos", KeyModifierMask::META | KeyModifierMask::SHIFT | Key::D); - ED_SHORTCUT_AND_COMMAND("editor/toggle_last_opened_bottom_panel", TTRC("Toggle Last Opened Bottom Panel"), KeyModifierMask::CMD_OR_CTRL | Key::J); - distraction_free->set_shortcut(ED_GET_SHORTCUT("editor/distraction_free_mode")); - distraction_free->set_tooltip_text(TTRC("Toggle distraction-free mode.")); - distraction_free->set_accessibility_name(TTRC("Distraction-free Mode")); - distraction_free->set_toggle_mode(true); - scene_tabs->add_extra_button(distraction_free); - distraction_free->connect(SceneStringName(pressed), callable_mp(this, &EditorNode::_toggle_distraction_free_mode)); - editor_main_screen = memnew(EditorMainScreen); editor_main_screen->set_custom_minimum_size(Size2(0, 80) * EDSCALE); editor_main_screen->set_draw_behind_parent(true); - srt->add_child(editor_main_screen); + top_split->add_child(editor_main_screen); editor_main_screen->set_v_size_flags(Control::SIZE_EXPAND_FILL); scene_root = memnew(SubViewport); @@ -7871,13 +7852,9 @@ EditorNode::EditorNode() { ED_SHORTCUT_OVERRIDE("editor/quit_to_project_list", "macos", KeyModifierMask::META + KeyModifierMask::CTRL + KeyModifierMask::ALT + Key::Q); project_menu->add_shortcut(ED_GET_SHORTCUT("editor/quit_to_project_list"), PROJECT_QUIT_TO_PROJECT_MANAGER, true); - // Spacer to center 2D / 3D / Script buttons. - left_spacer = memnew(HBoxContainer); - left_spacer->set_mouse_filter(Control::MOUSE_FILTER_PASS); - left_spacer->set_h_size_flags(Control::SIZE_EXPAND_FILL); - title_bar->add_child(left_spacer); - if (can_expand && global_menu) { + // Separator main_menu. + title_bar->add_child(memnew(VSeparator)); project_title = memnew(Label); project_title->add_theme_font_override(SceneStringName(font), theme->get_font(SNAME("bold"), EditorStringName(EditorFonts))); project_title->add_theme_font_size_override(SceneStringName(font_size), theme->get_font_size(SNAME("bold_size"), EditorStringName(EditorFonts))); @@ -7885,15 +7862,9 @@ EditorNode::EditorNode() { project_title->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER); project_title->set_h_size_flags(Control::SIZE_EXPAND_FILL); project_title->set_mouse_filter(Control::MOUSE_FILTER_PASS); - left_spacer->add_child(project_title); + title_bar->add_child(project_title); } - HBoxContainer *main_editor_button_hb = memnew(HBoxContainer); - main_editor_button_hb->set_mouse_filter(Control::MOUSE_FILTER_STOP); - editor_main_screen->set_button_container(main_editor_button_hb); - title_bar->add_child(main_editor_button_hb); - title_bar->set_center_control(main_editor_button_hb); - // Options are added and handled by DebuggerEditorPlugin. debug_menu = memnew(PopupMenu); _add_to_main_menu(TTRC("Debug"), debug_menu); @@ -7975,11 +7946,40 @@ EditorNode::EditorNode() { } help_menu->add_icon_shortcut(_get_editor_theme_native_menu_icon(SNAME("Heart"), global_menu, dark_mode), ED_SHORTCUT_AND_COMMAND("editor/support_development", TTRC("Support Godot Development")), HELP_SUPPORT_GODOT_DEVELOPMENT); - // Spacer to center 2D / 3D / Script buttons. - right_spacer = memnew(Control); - right_spacer->set_mouse_filter(Control::MOUSE_FILTER_PASS); - right_spacer->set_h_size_flags(Control::SIZE_EXPAND_FILL); - title_bar->add_child(right_spacer); + // Separator main_menu. + title_bar->add_child(memnew(VSeparator)); + + scene_tabs = memnew(EditorSceneTabs); + title_bar->add_child(scene_tabs); + scene_tabs->set_h_size_flags(Control::SIZE_EXPAND_FILL); + scene_tabs->set_v_size_flags(Control::SIZE_EXPAND_FILL); + scene_tabs->set_mouse_filter(Control::MOUSE_FILTER_PASS); + scene_tabs->connect("tab_changed", callable_mp(this, &EditorNode::_set_current_scene)); + scene_tabs->connect("tab_closed", callable_mp(this, &EditorNode::_scene_tab_closed)); + + distraction_free = memnew(Button); + distraction_free->set_theme_type_variation("FlatMenuButton"); + ED_SHORTCUT_AND_COMMAND("editor/distraction_free_mode", TTRC("Distraction Free Mode"), KeyModifierMask::CTRL | KeyModifierMask::SHIFT | Key::F11); + ED_SHORTCUT_OVERRIDE("editor/distraction_free_mode", "macos", KeyModifierMask::META | KeyModifierMask::SHIFT | Key::D); + ED_SHORTCUT_AND_COMMAND("editor/toggle_last_opened_bottom_panel", TTRC("Toggle Last Opened Bottom Panel"), KeyModifierMask::CMD_OR_CTRL | Key::J); + distraction_free->set_shortcut(ED_GET_SHORTCUT("editor/distraction_free_mode")); + distraction_free->set_tooltip_text(TTRC("Toggle distraction-free mode.")); + distraction_free->set_accessibility_name(TTRC("Distraction-free Mode")); + distraction_free->set_toggle_mode(true); + scene_tabs->add_extra_button(distraction_free); + distraction_free->connect(SceneStringName(pressed), callable_mp(this, &EditorNode::_toggle_distraction_free_mode)); + + // Separator scene_tabs. + title_bar->add_child(memnew(VSeparator)); + + HBoxContainer *main_editor_button_hb = memnew(HBoxContainer); + main_editor_button_hb->set_mouse_filter(Control::MOUSE_FILTER_STOP); + editor_main_screen->set_button_container(main_editor_button_hb); + title_bar->add_child(main_editor_button_hb); + title_bar->set_center_control(main_editor_button_hb); + + // Separator for main_editor_button_hb. + title_bar->add_child(memnew(VSeparator)); project_run_bar = memnew(EditorRunBar); project_run_bar->set_mouse_filter(Control::MOUSE_FILTER_STOP); @@ -7999,6 +7999,7 @@ EditorNode::EditorNode() { renderer->set_focus_mode(Control::FOCUS_NONE); renderer->set_tooltip_text(TTR("Choose a rendering method.\n\nNotes:\n- On mobile platforms, the Mobile rendering method is used if Forward+ is selected here.\n- On the web platform, the Compatibility rendering method is always used.")); renderer->set_accessibility_name(TTRC("Rendering Method")); + renderer->hide(); right_menu_hb->add_child(renderer); @@ -8513,16 +8514,6 @@ EditorNode::EditorNode() { add_child(screenshot_timer); screenshot_timer->set_owner(get_owner()); - // Adjust spacers to center 2D / 3D / Script buttons. - if (main_menu_button != nullptr) { - int max_w = MAX(project_run_bar->get_minimum_size().x + right_menu_hb->get_minimum_size().x, main_menu_button->get_minimum_size().x); - left_spacer->set_custom_minimum_size(Size2(MAX(0, max_w - main_menu_button->get_minimum_size().x), 0)); - right_spacer->set_custom_minimum_size(Size2(MAX(0, max_w - project_run_bar->get_minimum_size().x - right_menu_hb->get_minimum_size().x), 0)); - } else { - int max_w = MAX(project_run_bar->get_minimum_size().x + right_menu_hb->get_minimum_size().x, main_menu_bar->get_minimum_size().x); - left_spacer->set_custom_minimum_size(Size2(MAX(0, max_w - main_menu_bar->get_minimum_size().x), 0)); - right_spacer->set_custom_minimum_size(Size2(MAX(0, max_w - project_run_bar->get_minimum_size().x - right_menu_hb->get_minimum_size().x), 0)); - } // Extend menu bar to window title. if (can_expand) { DisplayServer::get_singleton()->process_events(); diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp index d9defd8a9326..311618ddaea7 100644 --- a/editor/export/editor_export_platform.cpp +++ b/editor/export/editor_export_platform.cpp @@ -1952,7 +1952,7 @@ Error EditorExportPlatform::save_pack(const Ref &p_preset, b int64_t pck_start_pos = f->get_position(); - f->store_32(PACK_HEADER_MAGIC); + f->store_32(PACK_HEADER_ALTER); f->store_32(PACK_FORMAT_VERSION); f->store_32(GODOT_VERSION_MAJOR); f->store_32(GODOT_VERSION_MINOR); @@ -2121,7 +2121,7 @@ Error EditorExportPlatform::save_pack(const Ref &p_preset, b uint64_t pck_size = f->get_position() - pck_start_pos; f->store_64(pck_size); - f->store_32(PACK_HEADER_MAGIC); + f->store_32(PACK_HEADER_ALTER); if (r_embedded_size) { *r_embedded_size = f->get_position() - embed_pos; diff --git a/editor/gui/editor_scene_tabs.cpp b/editor/gui/editor_scene_tabs.cpp index 504e96e09062..288ae4a93cc1 100644 --- a/editor/gui/editor_scene_tabs.cpp +++ b/editor/gui/editor_scene_tabs.cpp @@ -51,7 +51,6 @@ void EditorSceneTabs::_notification(int p_what) { switch (p_what) { case NOTIFICATION_THEME_CHANGED: { - tabbar_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("tabbar_background"), SNAME("TabContainer"))); scene_tabs->add_theme_constant_override("icon_max_width", get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor))); scene_tab_add->set_button_icon(get_editor_theme_icon(SNAME("Add"))); @@ -405,10 +404,8 @@ EditorSceneTabs::EditorSceneTabs() { set_process_shortcut_input(true); set_process_unhandled_key_input(true); - tabbar_panel = memnew(PanelContainer); - add_child(tabbar_panel); tabbar_container = memnew(HBoxContainer); - tabbar_panel->add_child(tabbar_container); + add_child(tabbar_container); scene_tabs = memnew(TabBar); scene_tabs->set_select_with_rmb(true); @@ -440,6 +437,7 @@ EditorSceneTabs::EditorSceneTabs() { scene_tab_add->set_accessibility_name(TTRC("Add Scene")); scene_tabs->add_child(scene_tab_add); scene_tab_add->connect(SceneStringName(pressed), callable_mp(EditorNode::get_singleton(), &EditorNode::trigger_menu_option).bind(EditorNode::SCENE_NEW_SCENE, false)); + scene_tab_add->hide(); scene_tab_add_ph = memnew(Control); scene_tab_add_ph->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); diff --git a/editor/gui/editor_scene_tabs.h b/editor/gui/editor_scene_tabs.h index 3b23aea7e8a2..d1ee62242270 100644 --- a/editor/gui/editor_scene_tabs.h +++ b/editor/gui/editor_scene_tabs.h @@ -55,7 +55,6 @@ class EditorSceneTabs : public MarginContainer { }; private: - PanelContainer *tabbar_panel = nullptr; HBoxContainer *tabbar_container = nullptr; TabBar *scene_tabs = nullptr; diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index f78e3b2ad12a..55f9800ce9bd 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -42,6 +42,7 @@ #include "editor/debugger/editor_debugger_node.h" #include "editor/debugger/script_editor_debugger.h" #include "editor/editor_command_palette.h" +#include "editor/editor_dock_manager.h" #include "editor/editor_help_search.h" #include "editor/editor_interface.h" #include "editor/editor_main_screen.h" @@ -1263,13 +1264,25 @@ TypedArray