summaryrefslogtreecommitdiffstats
path: root/editor
diff options
context:
space:
mode:
authorA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-01-13 13:23:32 +0100
committerA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-02-13 10:30:44 +0100
commit8b3c12d8df5bc8964e8037a0cc0cb4d38d764a20 (patch)
tree8bd2cf6a9564a5ed8173daa84f1e7584b0a8d48a /editor
parent9050ee1542f4e071188e8e4f868f3507bb31b3dc (diff)
downloadredot-engine-8b3c12d8df5bc8964e8037a0cc0cb4d38d764a20.tar.gz
Allow configuring the maximum width for atlas import
Diffstat (limited to 'editor')
-rw-r--r--editor/import/resource_importer_texture_atlas.cpp9
-rw-r--r--editor/register_editor_types.cpp2
2 files changed, 10 insertions, 1 deletions
diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp
index 9edf468ec6..d6ce39f6a6 100644
--- a/editor/import/resource_importer_texture_atlas.cpp
+++ b/editor/import/resource_importer_texture_atlas.cpp
@@ -31,6 +31,7 @@
#include "resource_importer_texture_atlas.h"
#include "atlas_import_failed.xpm"
+#include "core/config/project_settings.h"
#include "core/io/file_access.h"
#include "core/io/image_loader.h"
#include "core/io/resource_saver.h"
@@ -276,9 +277,15 @@ Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file
idx++;
}
+ const int max_width = (int)GLOBAL_GET("editor/import/atlas_max_width");
+
//pack the charts
int atlas_width, atlas_height;
- EditorAtlasPacker::chart_pack(charts, atlas_width, atlas_height);
+ EditorAtlasPacker::chart_pack(charts, atlas_width, atlas_height, max_width);
+
+ if (atlas_height > max_width * 2) {
+ WARN_PRINT(vformat(TTR("%s: Atlas texture significantly larger on one axis (%d), consider changing the `editor/import/atlas_max_width` Project Setting to allow a wider texture, making the result more even in size."), p_group_file, atlas_height));
+ }
//blit the atlas
Ref<Image> new_atlas = Image::create_empty(atlas_width, atlas_height, false, Image::FORMAT_RGBA8);
diff --git a/editor/register_editor_types.cpp b/editor/register_editor_types.cpp
index 484fa7b85f..db1f5b439d 100644
--- a/editor/register_editor_types.cpp
+++ b/editor/register_editor_types.cpp
@@ -272,6 +272,8 @@ void register_editor_types() {
GLOBAL_DEF("editor/import/reimport_missing_imported_files", true);
GLOBAL_DEF("editor/import/use_multiple_threads", true);
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "editor/import/atlas_max_width", PROPERTY_HINT_RANGE, "128,8192,1,or_greater"), 2048);
+
GLOBAL_DEF("editor/export/convert_text_resources_to_binary", true);
GLOBAL_DEF("editor/version_control/plugin_name", "");