How to develop importer for bundled (zipped) resources?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Rodrigo (Spy)

I’m coding an importer for an exported file from an illustration and animation production software.

The exported file is a compressed (zip) file with the extension renamed. It contains files with descriptive data about the animation and nodes hierarchy and the images needed to reconstruct the asset.

I have been using gdUnzip to work the files in the compressed bundle, including extracting the image files to the project “res://(path)” folder.

After extracting the images, I cannot load the texture when I create the sprite because the Godot System does not seem to import resources within an import process. I need to switch application windows and return to Godot, so it imports the images, and then I need to reimport the file to get the resources (images) loaded as expected.

If I create an ImageTexture, loading the image from the disk, it works, but the scene/node/asset created is huge since the image data is saved in the imported file without compression.

Is there a way to import a known and native Godot resource, such as images, extracted in the middle of an importing process? How would one import an asset with several files and file types?

:bust_in_silhouette: Reply From: Calinou

If I create an ImageTexture, loading the image from the disk, it works, but the scene/node/asset created is huge since the image data is saved in the imported file without compression.

Save the binary data to an external .res file instead of making it a built-in resource. Otherwise, the resource will be serialized as Base64 in the .tscn file, making saving/loading slower and resulting in a larger file.