ResourceImporterTextureAtlas

继承: ResourceImporter < RefCounted < Object

Imports a collection of textures from a PNG image into an optimized AtlasTexture for 2D rendering.

描述

This imports a collection of textures from a PNG image into an AtlasTexture or 2D ArrayMesh. This can be used to save memory when importing 2D animations from spritesheets. Texture atlases are only supported in 2D rendering, not 3D. See also ResourceImporterTexture and ResourceImporterLayeredTexture.

Note: ResourceImporterTextureAtlas does not handle importing TileSetAtlasSource, which is created using the TileSet editor instead.

属性


属性说明

String atlas_file = ""

Path to the atlas spritesheet. This must be set to valid path to a PNG image. Otherwise, the atlas will fail to import.


bool crop_to_region = false

If true, discards empty areas from the atlas. This only affects final sprite positioning, not storage. See also trim_alpha_border_from_region.

Note: Only effective if import_mode is Region.


int import_mode = 0

Region: Imports the atlas in an AtlasTexture resource, which is rendered as a rectangle. This is fast to render, but transparent areas still have to be rendered if they can't be trimmed effectively by trim_alpha_border_from_region. This can reduce performance when rendering large sprites on screen.

Mesh: Imports the atlas as an ArrayMesh resource, keeping the original bitmap visible (but rendered as a polygon). This can be used to reduce fill rate when rendering large transparent sprites, at the cost of slower rendering if there are little to no transparent areas in the sprite.


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.

1

本方法通常需要用户覆盖才能生效。

2

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。