|
@@ -31,6 +31,7 @@
|
|
#include "resource_importer_texture_atlas.h"
|
|
#include "resource_importer_texture_atlas.h"
|
|
|
|
|
|
#include "atlas_import_failed.xpm"
|
|
#include "atlas_import_failed.xpm"
|
|
|
|
+#include "core/config/project_settings.h"
|
|
#include "core/io/file_access.h"
|
|
#include "core/io/file_access.h"
|
|
#include "core/io/image_loader.h"
|
|
#include "core/io/image_loader.h"
|
|
#include "core/io/resource_saver.h"
|
|
#include "core/io/resource_saver.h"
|
|
@@ -276,9 +277,15 @@ Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file
|
|
idx++;
|
|
idx++;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const int max_width = (int)GLOBAL_GET("editor/import/atlas_max_width");
|
|
|
|
+
|
|
//pack the charts
|
|
//pack the charts
|
|
int atlas_width, atlas_height;
|
|
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
|
|
//blit the atlas
|
|
Ref<Image> new_atlas = Image::create_empty(atlas_width, atlas_height, false, Image::FORMAT_RGBA8);
|
|
Ref<Image> new_atlas = Image::create_empty(atlas_width, atlas_height, false, Image::FORMAT_RGBA8);
|