2shady4u / godot-krita-importer

Plugin for Godot Engine to import Krita KRA-files
MIT License
29 stars 1 forks source link

Import sprites as files #8

Closed timkrief closed 5 days ago

timkrief commented 1 month ago

I needed my sprites to be imported as png files into my project to be able to use them as normal images in godot. That way nodes can be copied out of the imported kra scene and used in other scenes independently. Plus they then can be compressed by godot when exporting etc.

I added an "import as files option" in the importer.

It's working really well: image

It creates a folder where all the files are and instead of using raw image data, it loads the pngs using godot load function, using a compressed version as it would do for other pngs imported into godot. It creates directories to respect layers tree.

You can see it's pointing to the png file (imported version of the png file created by godot) and no longer an ImageTexture using RAW data. image

ImageTexture can be efficient at runtime, but using proper images makes more sense to me if I need to export the project. Plus, that way it's easier to use imported stuff in other scenes.

timkrief commented 1 month ago

Since I need to use append_import_external_resource for this, I have to make import_paint_layer and import_group_layer non static, is this ok or was the fact that they were static important?

2shady4u commented 1 month ago

Since I need to use append_import_external_resource for this, I have to make import_paint_layer and import_group_layer non static, is this ok or was the fact that they were static important?

Honestly, I don't remember if there was any particular reason why I decided to make those methods static. If you don't encounter any unexpected issues when converting those methods to non-static, then it should be ok.