Repository navigation
sandbox_scene: a negative --tex-size is a usage error instead of a scene with no textures - #8731
Open
MarchalMaxim wants to merge 1 commit into
Open
MarchalMaxim wants to merge 1 commit into
MarchalMaxim wants to merge 1 commit into
Conversation
…ene with no textures
Before, --tex-size -1 passed argument checks; dds_png.downscale_rgba rejected
it with DdsError, texture_bytes swallowed that and returned None, so every
texture was dropped and the scene was written with exit 0. Now main() rejects
a negative value next to the --radius and --max-props checks ("--tex-size must
be non-negative", exit 2, nothing written). 0 still means full size.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested c51f238 on Linux, Python 3.12.16 and 3.14.4: pass
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: a new item, claim
What and why
tools/sandbox_scene.pychecks--radiusand--max-propsinmain()but not--tex-size. A negative value reachesdds_png.downscale_rgba(), which raisesDdsError("Invalid max_size: -1");texture_bytes()catchesDdsErrorand returnsNone, so every texture was silently dropped and the scene was still written with exit 0, as if no textures had been found.main()now refuses a negative--tex-sizenext to the other two checks, in the same wording (--tex-size must be non-negative, parser error, exit 2), and writes nothing.0keeps its meaning (full size).Tested
Windows 11, CPython 3.11.9, CPU only, no game files or GPU. Every input is built by hand in the test.
python -I tests/test_sandbox_scene.py: with the new tests on unmodified code, 13 tests, 1 failure (SystemExit not raised); with the fix, 13 tests OK. Red was reproduced a second time in a clean worktree of main with only the test file copied in.python -Isnippet with a hand-built 2x2 RGBA DDS:texture_bytesreturns a 24-byte blob at sizes 256 and 0, andNoneat -1.0still exits 0 and writes a scene.python -I -m compileall -qandpython -I scripts/check_no_game_data.pyon both changed files: exit 0.Other open PRs near this code: Open PRs #5550, #6197 and #5943 touch the same two files for other
--out/--entitieschecks; none of their titles concerns--tex-size.AI-assisted: yes (Claude Code; the fix was written by one agent and re-verified red/green by a second, independent one)
Checklist
docs/design.md, with how it was confirmed. (Not applicable: no translator rule.)🤖 Generated with Claude Code