Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

ResourceImporterTextureAtlas

繼承: ResourceImporter < RefCounted < Object

將PNG 影像中的紋理集合匯入至最佳化的AtlasTexture 以進行2D 算繪。

說明

這會將 PNG 圖像中的紋理集合匯入到 AtlasTexture 或 2D ArrayMesh 中。從 spritesheet 匯入 2D 動畫時,這可用於節省記憶體。紋理合集只是支援紋理合集。 2D 算繪,而不是3D。另請參閱ResourceImporterTextureResourceImporterLayeredTexture

注意: ResourceImporterTextureAtlas 不處理匯入 TileSetAtlasSource,它是使用 TileSet 編輯器建立的。

屬性

String

atlas_file

""

bool

crop_to_region

false

int

import_mode

0

bool

trim_alpha_border_from_region

true


屬性說明

String atlas_file = "" 🔗

atlas spritesheet 的路徑。此必須設定為 PNG 映像的有效路徑。否則,atlas 將無法匯入。


bool crop_to_region = false 🔗

如果true,則丟棄合集中的空白區域。這只會影響最終的精靈定位,而不影響儲存。另請參閱trim_alpha_border_from_region

注意: 僅在 import_modeRegion 時有效。


int import_mode = 0 🔗

Region:AtlasTexture 資源中匯入合集,該合集呈現為矩形。這算繪速度很快,但仍需要透明區域如果trim_alpha_border_from_region無法有效修剪它們,則算繪它們。在螢幕上算繪大型精靈時,這會降低效能。

Mesh: 將合集匯入為 ArrayMesh 資源,保持原始位圖可見(但算繪為多邊形)。這可用於在算繪大型透明精靈時降低填充率,但如果精靈中幾乎沒有透明區域,則算繪速度會變慢。


bool trim_alpha_border_from_region = true 🔗

If true, trims the region to exclude fully transparent pixels using a clipping rectangle (which is never rotated). This can be used to save memory. See also crop_to_region.

Note: Only effective if import_mode is Region.