You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-19 14:31:59 +00:00
Merge pull request #47213 from timothyqiu/project-icon-size-3.x
[3.x] Fix project icon size in Project Manager
This commit is contained in:
@@ -246,15 +246,8 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
|
|||||||
// Generate icons.
|
// Generate icons.
|
||||||
if (!p_only_thumbs) {
|
if (!p_only_thumbs) {
|
||||||
for (int i = 0; i < editor_icons_count; i++) {
|
for (int i = 0; i < editor_icons_count; i++) {
|
||||||
float icon_scale = EDSCALE;
|
|
||||||
|
|
||||||
// Always keep the DefaultProjectIcon at the default size
|
|
||||||
if (strcmp(editor_icons_names[i], "DefaultProjectIcon") == 0) {
|
|
||||||
icon_scale = 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int is_exception = exceptions.has(editor_icons_names[i]);
|
const int is_exception = exceptions.has(editor_icons_names[i]);
|
||||||
const Ref<ImageTexture> icon = editor_generate_icon(i, !is_exception, icon_scale);
|
const Ref<ImageTexture> icon = editor_generate_icon(i, !is_exception);
|
||||||
|
|
||||||
p_theme->set_icon(editor_icons_names[i], "EditorIcons", icon);
|
p_theme->set_icon(editor_icons_names[i], "EditorIcons", icon);
|
||||||
}
|
}
|
||||||
@@ -1360,3 +1353,15 @@ Ref<Theme> create_custom_theme(const Ref<Theme> p_theme) {
|
|||||||
|
|
||||||
return theme;
|
return theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ref<ImageTexture> create_unscaled_default_project_icon() {
|
||||||
|
#ifdef SVG_ENABLED
|
||||||
|
for (int i = 0; i < editor_icons_count; i++) {
|
||||||
|
// ESCALE should never affect size of the icon
|
||||||
|
if (strcmp(editor_icons_names[i], "DefaultProjectIcon") == 0) {
|
||||||
|
return editor_generate_icon(i, false, 1.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Ref<ImageTexture>(memnew(ImageTexture));
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,10 +31,13 @@
|
|||||||
#ifndef EDITOR_THEMES_H
|
#ifndef EDITOR_THEMES_H
|
||||||
#define EDITOR_THEMES_H
|
#define EDITOR_THEMES_H
|
||||||
|
|
||||||
|
#include "scene/resources/texture.h"
|
||||||
#include "scene/resources/theme.h"
|
#include "scene/resources/theme.h"
|
||||||
|
|
||||||
Ref<Theme> create_editor_theme(Ref<Theme> p_theme = NULL);
|
Ref<Theme> create_editor_theme(Ref<Theme> p_theme = NULL);
|
||||||
|
|
||||||
Ref<Theme> create_custom_theme(Ref<Theme> p_theme = NULL);
|
Ref<Theme> create_custom_theme(Ref<Theme> p_theme = NULL);
|
||||||
|
|
||||||
|
Ref<ImageTexture> create_unscaled_default_project_icon();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -504,7 +504,7 @@ private:
|
|||||||
if (ProjectSettings::get_singleton()->save_custom(dir.plus_file("project.godot"), initial_settings, Vector<String>(), false) != OK) {
|
if (ProjectSettings::get_singleton()->save_custom(dir.plus_file("project.godot"), initial_settings, Vector<String>(), false) != OK) {
|
||||||
set_message(TTR("Couldn't create project.godot in project path."), MESSAGE_ERROR);
|
set_message(TTR("Couldn't create project.godot in project path."), MESSAGE_ERROR);
|
||||||
} else {
|
} else {
|
||||||
ResourceSaver::save(dir.plus_file("icon.png"), get_icon("DefaultProjectIcon", "EditorIcons"));
|
ResourceSaver::save(dir.plus_file("icon.png"), create_unscaled_default_project_icon());
|
||||||
|
|
||||||
FileAccess *f = FileAccess::open(dir.plus_file("default_env.tres"), FileAccess::WRITE);
|
FileAccess *f = FileAccess::open(dir.plus_file("default_env.tres"), FileAccess::WRITE);
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
|||||||
Reference in New Issue
Block a user