Sriseru wrote:So I finally tried out your script (yes, it took me this long... sorry about that, lol) and I'm not sure if I'm doing something wrong or not, but after running your script all of the original .png, .wav, and .mp3 files remain alongside the converted files. Is this supposed to happen? Because if so, it does make it kind of a hassle to remove the original files. Would it be possible to add something in the script to make it delete all of the original files automatically after conversion?
hamsterus wrote:Seifens seems to have written the script with updating in mind. As in on the second execution it will convert any new files you added + the ones you've modified, skipping the others. It's intended to be ran on your production enviroment since it doesn't change any of the original files. Say you run it when you develop 0.24 and it compresses 1000 files. You then develop 0.25 and run it again, it will only compress the images and sounds you've added OR modified since then.
Hamsterus is correct here. This is intentional for the sake of preserving your lossless source data so it can be iterated on without worrying about the quality degrading as you decompress and recompress files repeatedly for spot changes. The idea is that you run the command periodically as you're editing, and write your archive definitions to exclude the uncompressed assets so only the webp/ogg files get packed into the rpas that you distribute.
Given that you're keeping the originals elsewhere, the script could safely be modified to delete the source data. I don't think I'd want to make this default behaior, as you'd lose the selective update functionality and would have to copy your source data over more frequently and carefully to avoid large recompressions. One potential additional advantage to keeping the source images around is that theoretically if you remove one of the source images the script could automatically detect that and clean up the compressed image as well. It doesn't currently work like that but that would be a simple enough modification.
If your externally stored source data is using the same directory structure and file names you're using for the game, then it would be possible to change the script to read from one directory tree and write to another, though you'd have to configure it for your particular arrangement.