From 9b9adcb9c2a2a89ead869a7784290a58c2d3e41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=CC=84vels=20Nadtoc=CC=8Cajevs?= <7645683+bruvzg@users.noreply.github.com> Date: Mon, 18 May 2026 12:39:56 +0300 Subject: [PATCH] Fix credit roll in the project manager. --- editor/gui/credits_roll.cpp | 15 ++++++++++--- editor/gui/editor_about.cpp | 27 ++++++++++++------------ editor/project_manager/project_manager.h | 3 +++ 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/editor/gui/credits_roll.cpp b/editor/gui/credits_roll.cpp index 9bc67210a8..9a2188b192 100644 --- a/editor/gui/credits_roll.cpp +++ b/editor/gui/credits_roll.cpp @@ -38,6 +38,7 @@ #include "core/string/string_builder.h" #include "editor/editor_node.h" #include "editor/editor_string_names.h" +#include "editor/project_manager/project_manager.h" #include "editor/themes/editor_scale.h" #include "scene/gui/box_container.h" #include "scene/gui/color_rect.h" @@ -146,13 +147,21 @@ void CreditsRoll::_notification(int p_what) { void CreditsRoll::roll_credits() { if (!project_manager) { - font_size_normal = EditorNode::get_singleton()->get_editor_theme()->get_font_size("main_size", EditorStringName(EditorFonts)) * 2; + Ref theme; + if (EditorNode::get_singleton()) { + theme = EditorNode::get_singleton()->get_editor_theme(); + } else if (ProjectManager::get_singleton()) { + theme = ProjectManager::get_singleton()->get_theme(); + } else { + return; + } + font_size_normal = theme->get_font_size("main_size", EditorStringName(EditorFonts)) * 2; font_size_header = font_size_normal + 10 * EDSCALE; font_size_big_header = font_size_header + 20 * EDSCALE; - bold_font = EditorNode::get_singleton()->get_editor_theme()->get_font("bold", EditorStringName(EditorFonts)); + bold_font = theme->get_font("bold", EditorStringName(EditorFonts)); { - const Ref logo_texture = EditorNode::get_singleton()->get_editor_theme()->get_icon("Logo", EditorStringName(EditorIcons)); + const Ref logo_texture = theme->get_icon("Logo", EditorStringName(EditorIcons)); TextureRect *logo = memnew(TextureRect); logo->set_custom_minimum_size(Vector2(0, logo_texture->get_height() * 3)); diff --git a/editor/gui/editor_about.cpp b/editor/gui/editor_about.cpp index db1e9d4350..708bf0f003 100644 --- a/editor/gui/editor_about.cpp +++ b/editor/gui/editor_about.cpp @@ -123,7 +123,7 @@ void EditorAbout::_item_activated(int p_idx, ItemList *p_il) { OS::get_singleton()->shell_open(val); } else { // Easter egg! :D - if (EditorRunBar::get_singleton()->is_playing()) { + if (EditorRunBar::get_singleton() && EditorRunBar::get_singleton()->is_playing()) { // Don't allow if the game is running, as it will look weird if it's embedded. EditorToaster::get_singleton()->popup_str(TTR("No distractions for this, close that game first.")); return; @@ -157,19 +157,8 @@ Label *EditorAbout::_create_section(Control *p_parent, const String &p_name, con il->set_max_columns(p_flags.has_flag(FLAG_SINGLE_COLUMN) ? 1 : 16); il->add_theme_constant_override("h_separation", 16 * EDSCALE); - // Don't allow the Easter egg in the Project Manager. - if (p_flags.has_flag(FLAG_ALLOW_WEBSITE) || (p_flags.has_flag(FLAG_EASTER_EGG) && EditorNode::get_singleton())) { - Ref empty_stylebox = memnew(StyleBoxEmpty); - il->add_theme_style_override("focus", empty_stylebox); - il->add_theme_style_override("selected", empty_stylebox); - - il->connect("item_activated", callable_mp(this, &EditorAbout::_item_activated).bind(il)); - } else { - il->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); - il->set_focus_mode(Control::FOCUS_NONE); - } - const char *const *names_ptr = p_src; + bool has_website = false; if (p_flags.has_flag(FLAG_ALLOW_WEBSITE)) { il->connect(SceneStringName(resized), callable_mp(this, &EditorAbout::_item_list_resized).bind(il)); il->connect(SceneStringName(focus_exited), callable_mp(il, &ItemList::deselect_all)); @@ -185,6 +174,7 @@ Label *EditorAbout::_create_section(Control *p_parent, const String &p_name, con il->set_item_tooltip_enabled(-1, false); } else { il->set_item_metadata(-1, website); + has_website = true; } if (!*names_ptr && name.contains(" anonymous ")) { @@ -198,6 +188,17 @@ Label *EditorAbout::_create_section(Control *p_parent, const String &p_name, con } } + if ((has_website && p_flags.has_flag(FLAG_ALLOW_WEBSITE)) || p_flags.has_flag(FLAG_EASTER_EGG)) { + Ref empty_stylebox = memnew(StyleBoxEmpty); + il->add_theme_style_override("focus", empty_stylebox); + il->add_theme_style_override("selected", empty_stylebox); + + il->connect("item_activated", callable_mp(this, &EditorAbout::_item_activated).bind(il)); + } else { + il->set_mouse_filter(Control::MOUSE_FILTER_IGNORE); + il->set_focus_mode(Control::FOCUS_NONE); + } + name_lists.append(il); p_parent->add_child(il); diff --git a/editor/project_manager/project_manager.h b/editor/project_manager/project_manager.h index 20c213bd6b..501cdb03e9 100644 --- a/editor/project_manager/project_manager.h +++ b/editor/project_manager/project_manager.h @@ -285,6 +285,9 @@ public: void add_new_tag(const String &p_tag); + // Theme. + Ref get_theme() const { return theme; } + ProjectManager(); ~ProjectManager(); };