nklbdev / godot-4-importality

Universal raster graphics and animations importers pack
MIT License
337 stars 7 forks source link

Tileset import support #30

Closed ItsSunnyMonster closed 2 months ago

ItsSunnyMonster commented 3 months ago

I apologise if there is a way to do this already.

There should be an import option that allows importing all frames of an aseprite file into Godot in the form of a tileset for use in a tilemap.

nklbdev commented 2 months ago

I'm sorry, but this is impossible. If you want to import a file for use in a tileset, import it as Texture2D. Godot uses a sequence of cells to animate tiles. Unfortunately I can't convert Aseprite's frames into these sequences. You will have to manually convert your animations to these cells((((((( image

nklbdev commented 2 months ago

Maybe you want something different? For example, do you want to get a spritesheet from Aseprite's regular animation? image Then try importing this file as Sprite sheet (JSON). image

If you use the experimental Importality branch, in which the image is saved as PortableCompressedTexture2D, then you will only get a JSON resource, without the image itself. Sorry. It will be fixed in future.

But if you use the main Importality branch, then you will get a PNG image next to the aseprite-file. That's what you need! And if you load the imported JSON resource from code, you will get all information about frames and tags you need.

ItsSunnyMonster commented 2 months ago

Thank you for your response!

Sorry I wasn't clear enough with my issue,

I don't need the tileset to be animated. What I have is an aseprite file where each frame is a 16x16 terrain tile and I want to import it as a tileset which can be used in a tilemap.

nklbdev commented 2 months ago

Yes, that's a good approach! I started developing this type of import. Do you want to import this file as PortableCompressedTexture2D? It will contain metadata about all the tiles in it and the animations that you can assemble from those tiles using your own code.

Now the most difficult part remains - to split the resulting array of images into sections - one for each animation.

But I can release a version of the importer without this modification.

I once made an isometric strategy game and also used Aseprite animation frames to store tiles in them. This helped me make different types of terrain with different variations for my tile mapper built into the game. image

nklbdev commented 2 months ago

Please, try to use dev-branch of this repository.

To be safe, try experimenting on a new empty Godot project. Select Aseprite-file and select the importer for it: "Aseprite -> Sprite sheet (PortableCompressedTexture2D)". Try experimenting with the import settings. You will get a texture that has meta information with frame and animation data.

image

P.S.: All other importers will also create an embedded PortableCompressedTexture2D instead of a separate PNG file.

nklbdev commented 2 months ago

What version of godot are you using? To use this version of the importer you will need 4.3 beta1 that includes changes from 4.3 dev2 (changelog) that includes two my pull-requests:

Without them, the importer will not be able to create PortableCompressedTexture2D.

nklbdev commented 2 months ago

@ItsSunnyMonster, please tell me, have you tried the new version of the importer (see posts above)? Did it give you the result you wanted?

ItsSunnyMonster commented 2 months ago

Hello, sorry for not responding sooner. I have been quite busy recently and I had no time to try this. I will close this issue for now and maybe reopen it once I have the time to come back to this.