viniciusgerevini / godot-aseprite-wizard

Godot Editor plugin to help import Aseprite animations to AnimationPlayers, AnimatedSprites and SpriteFrames.
MIT License
821 stars 42 forks source link

Add a way to import an aseprite image as split layers #135

Open Lertsenem opened 5 months ago

Lertsenem commented 5 months ago

Hi, and thanks for your amazing plugin !

Sometimes I create an image with multiple layer in aseprite (for example: head, torso, leg_left, leg_right, etc.), and I for some reason I want to animate it in Godot as a cutout model rather than directly in aseprite.

For this use case, I'd love to be able to tick a box in the inspector dock, and instead of merging all the layers in the final image, the plugin would create one sprite by layer, correctly named and ordered.

Now I can already kinda do that in some way, selecting my aseprite file in the filesystem dock, using the Aseprite SpriteFrames importer, and ticking the "Split Layers" box (which is not on the Aseprite Texture Importer yet) to get all layers as separate images, then dragging those images on the scene to create them as Sprites, but it feels a bit hacky and I'm not sure this is really the intended use of that feature...

viniciusgerevini commented 5 months ago

Thanks @Lertsenem . Just checking if I understood correctly. Your suggestion is to in some way via the interface being able to import the aseprite file, split by layers and have the sprite nodes automatically created for each spritesheet, correct?

After you import the first time, how would you go about importing new layers? Or renaming them? What happens if you delete a layer? Is it ok if any subsequent update needs to be handled manually? Like, clicking re-import in the dock?

I'm thinking I can add a feature, like a context menu action in the node tree which would open a dialog with similar options as the import dock and including split by layers and split by slices. This would be mostly for covering the new layers at first. The good thing about this is that it would also be helpful for people using AnimationPlayers, as they can also be created via this process. But just a nice to have in this case.

Also in the mean time there might be an easier way to import those layers. If you are using the latest version you can create a Sprite node and in the inspector dock select the import mode as "Image" and a specific layer. After importing the first one you can duplicate the node, select a different layer and click import again. You can do this as many times you need and after that you can re-import individual layers via the dock, without having to use the Wizard dock.

One last thing:

Split Layers" box (which is not on the Aseprite Texture Importer yet) to get all layers as separate images

It did have this option some time ago and I removed it because the importers were buggy in Godot 3 and I didn't hear of anyone using split layers outside the wizard screen. If there is a good case for it I can look into bringing it back to Godot 4 as a different importer.

Lertsenem commented 5 months ago

Thanks @Lertsenem . Just checking if I understood correctly. Your suggestion is to in some way via the interface being able to import the aseprite file, split by layers and have the sprite nodes automatically created for each spritesheet, correct?

Yes, that's exactly what I'm looking for!

After you import the first time, how would you go about importing new layers? Or renaming them? What happens if you delete a layer? Is it ok if any subsequent update needs to be handled manually? Like, clicking re-import in the dock?

Since each layer would be separately imported in its own Sprite, I think it would be acceptable to let the user make the subsequent updates manually, probably by either updating the few layer/sprite sheets that they modified, or by deleting all the Sprites and re-importing everything if it's easier.

Also in the mean time there might be an easier way to import those layers. If you are using the latest version you can create a Sprite node and in the inspector dock select the import mode as "Image" and a specific layer. After importing the first one you can duplicate the node, select a different layer and click import again. You can do this as many times you need and after that you can re-import individual layers via the dock, without having to use the Wizard dock.

Yes, I figured that was indeed a solution. But doing it for a sprite with more than 10 layers quickly became tedious, which is why I was looking for a more automated process. :]

One last thing:

Split Layers" box (which is not on the Aseprite Texture Importer yet) to get all layers as separate images

It did have this option some time ago and I removed it because the importers were buggy in Godot 3 and I didn't hear of anyone using split layers outside the wizard screen. If there is a good case for it I can look into bringing it back to Godot 4 as a different importer.

To be fair, this option feels like it should rather be an Aseprite option ("export each layer separately") than a YATI option. But in the absence of it, I'm glad it exists here. :)

Martanti commented 2 weeks ago

Hello, I would also like to chip in and say it would be very useful to have a split layers option in my workflow, where in addition to having a regular texture I also create a normal map in the same aseprite file but on a different layer and then combine the two textures in Canvas Texture.