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

Change: add --no-palette-validation optional arg #322

Merged

Conversation

andythenorth
Copy link
Contributor

@andythenorth andythenorth commented Feb 24, 2024

To defend authors against mixing Windows / DOS palettes in the same grf, nmlc will open all sprite files from the filesystem and validate their palette. This is a separate step to sprite encoding.

For certain cases, this is of no benefit, and just increases compile times. For example, with Iron Horse:

  • sprites are generated via a separate PIL compile step prior to nmlc
  • the DOS palette is set during that sprite generation step as a necessary part of creating paletted image files
  • therefore the subsequent nmlc check is redundant

The nmlc palette check adds 1s to 2s to every Iron Horse compile for me, which is 5% to 10% of total compile time.

I previously tried to solve this in #254, by inferring when the sprites might not need processed, but that route was not viable, as it depended too much on assuming that we don't want validation if we're outputting nfo.

This route provides an explicit arg flag for authors to suppress validation.

The names of the flag and option probably are too long and not the best choice.

nml/main.py Outdated
@@ -224,6 +225,7 @@ def parse_cli(argv):
"--no-extra-zoom", action="store_false", dest="allow_extra_zoom", help="Skip extra zoom alternative sprites"
)
opt_parser.add_option("--no-32bpp", action="store_false", dest="allow_32bpp", help="Skip 32bpp alternative sprites")
opt_parser.add_option("--forcibly-skip-sprite-processing", action="store_true", dest="forcibly_skip_sprite_processing", help="Skip sprite validation processing")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a quite long option name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to --no-palette-validation

@andythenorth andythenorth force-pushed the suppress-palette-validation-2024-edition branch from 6d7eb3a to 9d74fe2 Compare February 24, 2024 17:04
@andythenorth andythenorth changed the title Change: add forcibly_skip_sprite_processing arg option Change: add --no-palette-validation optional arg Feb 24, 2024
nml/main.py Outdated Show resolved Hide resolved
@andythenorth andythenorth force-pushed the suppress-palette-validation-2024-edition branch from 6e276c6 to c2d5d2b Compare February 24, 2024 17:34
@glx22 glx22 merged commit 1cc4292 into OpenTTD:master Feb 24, 2024
21 checks passed
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

Successfully merging this pull request may close these issues.

2 participants