Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Preprocessing Hooks #5471

Closed
colinharvie opened this issue Apr 20, 2024 · 3 comments
Closed

Build Preprocessing Hooks #5471

colinharvie opened this issue Apr 20, 2024 · 3 comments

Comments

@colinharvie
Copy link

colinharvie commented Apr 20, 2024

I've modified my own launcher to do this for me, but I think it's useful enough that others might want it.

It would be really nice to have some way to pass functions to a the renpy builder that would allow us to modify / do preprocessing on files, etc.

For example the way I'm using it is that I've added some code to the archiver.Archive class add method, which runs all png files through pngquant (png compressor/optimizer), before adding them to the archive. This lets me produce a game with compressed images, while still letting me keep the uncompressed files pre-build.

Granted, this does cause the build to take 4 times as long because each file needs to be compressed, but it's still useful.

I currently just use this for processing files before adding to the game or archive, but I can see some other possible use cases as well.

Maybe something like:
build.preprocess("game/**.png",processPng)

@renpytom
Copy link
Member

I'd suggest writing a script that does your preprocessing, and then calls the CLI ( https://www.renpy.org/doc/html/cli.html ) to do the build.

@colinharvie
Copy link
Author

I probably will end up doing that, though I still think my initial suggestion of having a way people can hook into the build process and alter things would be beneficial, since then the community could make some "plug and play" scripts that can be implemented simply by dropping an rpy file in a folder somewhere.

It's a super low priority thing, just thought it would be a nice thing to have.

@furudean
Copy link

Check out https://github.com/kobaltcore/renkit, it adds support for this, among other things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants