Merge pull request #119541 from bruvzg/roll_pm
Fix credit roll in the project manager.
This commit is contained in:
@@ -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> 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<Texture2D> logo_texture = EditorNode::get_singleton()->get_editor_theme()->get_icon("Logo", EditorStringName(EditorIcons));
|
||||
const Ref<Texture2D> logo_texture = theme->get_icon("Logo", EditorStringName(EditorIcons));
|
||||
|
||||
TextureRect *logo = memnew(TextureRect);
|
||||
logo->set_custom_minimum_size(Vector2(0, logo_texture->get_height() * 3));
|
||||
|
||||
+14
-13
@@ -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<StyleBoxEmpty> 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<StyleBoxEmpty> 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);
|
||||
|
||||
@@ -285,6 +285,9 @@ public:
|
||||
|
||||
void add_new_tag(const String &p_tag);
|
||||
|
||||
// Theme.
|
||||
Ref<Theme> get_theme() const { return theme; }
|
||||
|
||||
ProjectManager();
|
||||
~ProjectManager();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user