You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 19:41:11 +00:00
Allow configuring the maximum width for atlas import
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user