Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/io/file_access_pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions core/io/file_access_pack.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion core/io/pck_packer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions editor/editor_main_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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<Texture2D> icon = p_editor->get_plugin_icon();
if (icon.is_null() && has_theme_icon(p_editor->get_plugin_name(), EditorStringName(EditorIcons))) {
Expand Down
95 changes: 43 additions & 52 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -7871,29 +7852,19 @@ 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)));
project_title->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS);
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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);

Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions editor/export/editor_export_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1952,7 +1952,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &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);
Expand Down Expand Up @@ -2121,7 +2121,7 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &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;
Expand Down
6 changes: 2 additions & 4 deletions editor/gui/editor_scene_tabs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion editor/gui/editor_scene_tabs.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class EditorSceneTabs : public MarginContainer {
};

private:
PanelContainer *tabbar_panel = nullptr;
HBoxContainer *tabbar_container = nullptr;

TabBar *scene_tabs = nullptr;
Expand Down
31 changes: 26 additions & 5 deletions editor/plugins/script_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -1263,13 +1264,25 @@ TypedArray<Script> ScriptEditor::_get_open_scripts() const {
}

bool ScriptEditor::toggle_files_panel() {
list_split->set_visible(!list_split->is_visible());
EditorSettings::get_singleton()->set_project_metadata("files_panel", "show_files_panel", list_split->is_visible());
return list_split->is_visible();
if (list_split_dock->is_inside_tree()) {
list_split_dock->remove_child(list_split);
script_split->add_child(list_split);
script_split->move_child(list_split, 0);
list_split->set_h_size_flags(SIZE_FILL);
EditorDockManager::get_singleton()->remove_dock(list_split_dock);
} else {
script_split->remove_child(list_split);
list_split_dock->add_child(list_split);
list_split->set_h_size_flags(SIZE_EXPAND_FILL);
EditorDockManager::get_singleton()->add_dock(list_split_dock, "Script", EditorDockManager::DOCK_SLOT_LEFT_BR, nullptr, "Script");
TabContainer *tb = dynamic_cast<TabContainer *>(list_split_dock->get_parent());
tb->set_current_tab(list_split_dock->get_index() - 1);
}
return list_split_dock->is_inside_tree();
}

bool ScriptEditor::is_files_panel_toggled() {
return list_split->is_visible();
return list_split_dock->is_inside_tree();
}

void ScriptEditor::_menu_option(int p_option) {
Expand Down Expand Up @@ -1800,6 +1813,7 @@ void ScriptEditor::_notification(int p_what) {
} break;

case NOTIFICATION_EXIT_TREE: {
list_split_dock->queue_free();
EditorRunBar::get_singleton()->disconnect("stop_pressed", callable_mp(this, &ScriptEditor::_editor_stop));
} break;

Expand Down Expand Up @@ -4182,8 +4196,15 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
overview_vbox->set_custom_minimum_size(Size2(0, 90));
overview_vbox->set_v_size_flags(SIZE_EXPAND_FILL);

list_split_dock = memnew(PanelContainer);
list_split_dock->set_v_size_flags(SIZE_EXPAND_FILL);
list_split_dock->set_h_size_flags(SIZE_EXPAND_FILL);
list_split_dock->set_name(TTR("Script"));

list_split->add_child(overview_vbox);
list_split->set_visible(EditorSettings::get_singleton()->get_project_metadata("files_panel", "show_files_panel", true));
if (EditorSettings::get_singleton()->get_project_metadata("files_panel", "show_files_panel", true)) {
toggle_files_panel();
}
buttons_hbox = memnew(HBoxContainer);
overview_vbox->add_child(buttons_hbox);

Expand Down
1 change: 1 addition & 0 deletions editor/plugins/script_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ class ScriptEditor : public PanelContainer {
ItemList *help_overview = nullptr;
bool help_overview_enabled;
VSplitContainer *list_split = nullptr;
PanelContainer *list_split_dock = nullptr;
TabContainer *tab_container = nullptr;
EditorFileDialog *file_dialog = nullptr;
AcceptDialog *error_dialog = nullptr;
Expand Down