:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ResourceImporterTextureAtlas.xml. .. _class_ResourceImporterTextureAtlas: ResourceImporterTextureAtlas ============================ **Inherits:** :ref:`ResourceImporter` **<** :ref:`RefCounted` **<** :ref:`Object` Imports a collection of textures from a PNG image into an optimized :ref:`AtlasTexture` for 2D rendering. .. rst-class:: classref-introduction-group Description ----------- This imports a collection of textures from a PNG image into an :ref:`AtlasTexture` or 2D :ref:`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 :ref:`ResourceImporterTexture` and :ref:`ResourceImporterLayeredTexture`. \ **Note:** **ResourceImporterTextureAtlas** does not handle importing :ref:`TileSetAtlasSource`, which is created using the :ref:`TileSet` editor instead. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-----------------------------+-----------------------------------------------------------------------------------------------------------------+-----------+ | :ref:`String` | :ref:`atlas_file` | ``""`` | +-----------------------------+-----------------------------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`crop_to_region` | ``false`` | +-----------------------------+-----------------------------------------------------------------------------------------------------------------+-----------+ | :ref:`int` | :ref:`import_mode` | ``0`` | +-----------------------------+-----------------------------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`trim_alpha_border_from_region` | ``true`` | +-----------------------------+-----------------------------------------------------------------------------------------------------------------+-----------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_ResourceImporterTextureAtlas_property_atlas_file: .. rst-class:: classref-property :ref:`String` **atlas_file** = ``""`` :ref:`🔗` Path to the atlas spritesheet. This *must* be set to valid path to a PNG image. Otherwise, the atlas will fail to import. .. rst-class:: classref-item-separator ---- .. _class_ResourceImporterTextureAtlas_property_crop_to_region: .. rst-class:: classref-property :ref:`bool` **crop_to_region** = ``false`` :ref:`🔗` If ``true``, discards empty areas from the atlas. This only affects final sprite positioning, not storage. See also :ref:`trim_alpha_border_from_region`. \ **Note:** Only effective if :ref:`import_mode` is **Region**. .. rst-class:: classref-item-separator ---- .. _class_ResourceImporterTextureAtlas_property_import_mode: .. rst-class:: classref-property :ref:`int` **import_mode** = ``0`` :ref:`🔗` **Region:** Imports the atlas in an :ref:`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 :ref:`trim_alpha_border_from_region`. This can reduce performance when rendering large sprites on screen. \ **Mesh:** Imports the atlas as an :ref:`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. .. rst-class:: classref-item-separator ---- .. _class_ResourceImporterTextureAtlas_property_trim_alpha_border_from_region: .. rst-class:: classref-property :ref:`bool` **trim_alpha_border_from_region** = ``true`` :ref:`🔗` 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 :ref:`crop_to_region`. \ **Note:** Only effective if :ref:`import_mode` is **Region**. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`