A c++ Godot engine module, to layer, pack, and merge textures at runtime.
Go to file
2019-10-22 19:55:40 +02:00
doc_classes Docs setup. 2019-10-22 02:10:35 +02:00
rectpack2D Implemented reference counting. 2019-10-21 23:18:06 +02:00
texture_resource Fixed bindings, and now the importers work. The Merger can use this Texture type by default. 2019-10-22 15:09:47 +02:00
.gitignore Initial Skeleton. 2019-10-20 21:19:00 +02:00
config.py Docs setup. 2019-10-22 02:10:35 +02:00
LICENSE Initial commit 2019-10-20 21:04:56 +02:00
README.md Update README.md 2019-10-22 19:55:40 +02:00
register_types.cpp Added the new resource, and it's importer to the build, and fixed compile. 2019-10-22 11:53:49 +02:00
register_types.h Renamed the module to texture_packer. 2019-10-21 21:05:02 +02:00
SCsub Added the new resource, and it's importer to the build, and fixed compile. 2019-10-22 11:53:49 +02:00
texture_merger.cpp Added missing editor_hint check. 2019-10-22 01:07:53 +02:00
texture_merger.h Added missing editor_hint check. 2019-10-22 01:07:53 +02:00
texture_packer.cpp Added a variant vector binding to TextureMerger. It will merge all textures on set. Added contains_texture to TexturePacker. Logic fixes in querying textures in TexturePacker. 2019-10-22 00:52:59 +02:00
texture_packer.h Added a variant vector binding to TextureMerger. It will merge all textures on set. Added contains_texture to TexturePacker. Logic fixes in querying textures in TexturePacker. 2019-10-22 00:52:59 +02:00

Texture Packer for the Godot Engine

This is a texture packer engine module, for the Godot Engine.

Internally it uses the legacy version of rectpack2D

Building

  1. Get the source code for the Godot Engine.
git clone https://github.com/godotengine/godot.git godot
  1. Go into Godot's modules directory.
cd ./godot/modules/
  1. Clone this repository
git clone https://github.com/Relintai/texture_packer texture_packer
  1. Build Godot. Tutorial

Features and Usage

TexturePacker

This is the class that can merge textures. Add every texture you want into it using it's API (add_texture()), and then call merge().

add_texture() will return an AtlasTexture, this is the texture you want to use in your classes. It is immediately usable, it will just contain the original texture. Calling merge() will change it, to point to the new (merged) texture.

Supports filters, custom background color, margins.

The keep_original_atlases option:

If you set this to true, and then add AtlasTexture(s), TexturePacker will change these ones (the ones you actually added) after the bake. You can use this for example to bake gui textures together, without changing the resources everywhere at runtime. Note: add_texture() will also return the AtlasTextures that you add.

Note: I only recommend using this if your ui textures need to change during runtime, if they don't you are better off making the atlas yourself during development.

TextureMerger

A Node that can bake textures for you. It uses TexturePacker internally.

It has an exposed Array, so you can assign textures to it in the editor.

PackerImageResource

This is a simple Texture, which just contains an imported Image. It has no logic for drawing.

Useful for textures you only need for baking, as this class will not register it's data into the VisualServer.

The module also contains an editor plugin which can import textures as PackerImageResource Resource.

To access it, click on a texture, switch to the import tab, and in the "Import As" Dropdown, select "Packer Image Recource".