summaryrefslogtreecommitdiffstats
path: root/editor
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-02-13 11:24:54 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-02-13 11:24:54 +0100
commit3834fb432eea2c8598fee4463fa9b7a4b9e665bd (patch)
tree23a7f4141e1a23c0deb8225bbec78563238b3cc3 /editor
parent76170379b305019bcaca5a9fa8dc07a9b259de3e (diff)
parent8b3c12d8df5bc8964e8037a0cc0cb4d38d764a20 (diff)
downloadredot-engine-3834fb432eea2c8598fee4463fa9b7a4b9e665bd.tar.gz
Merge pull request #87145 from AThousandShips/atlas_fix_size
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", "");