← 输入框|github.com|刷新
Skip to content

Preserve Wang terrain classes when loading JSON tilesets - #91

Open
civilwarinfrance wants to merge 1 commit into
pythonarcade:developmentfrom
civilwarinfrance:fix/json-wang-classes
Open

civilwarinfrance wants to merge 1 commit into
pythonarcade:developmentfrom
civilwarinfrance:fix/json-wang-classes

Conversation

@civilwarinfrance

Copy link
Copy Markdown

Loading a JSON tileset silently drops the optional class fields on Wang sets and colors. The same fields already load correctly from TSX, and both public model classes already expose class_. This leaves applications with different terrain metadata depending on export format.

Copy the optional class fields using the same behavior as the TMX parser, including explicit empty strings. The terrain type field (corner/edge/mixed) remains separate.

The integration tests load complete JSON/TSX tilesets through parse_tileset(), covering independent set/color classes, omitted fields and empty strings, while checking properties and Wang IDs. Original source: 6 failures and 8 controls passing; fixed: all 14 cases pass.

Validation on macOS/Python 3.14:

  • Full suite: 140 passed, 96% coverage.
  • Mypy passes all 27 package files.
  • New test passes Black, isort, Ruff and flake8; whitespace check passes.
  • Existing full-package style failures are unchanged against an untouched copy of development: Ruff178 findings, Black6 files, isort7 files, flake8 232 findings. No full-package lint pass claimed.
  • Other platforms and hosted CI remain unverified.

Tiled documents both optional class fields: https://doc.mapeditor.org/en/stable/reference/json-map-format/#wang-set

AI assistance was used to identify, reproduce, implement and test this fix. This is a code-inspection finding; no production incident is claimed.

AI-assisted implementation and testing with OpenAI Codex.
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.

1 participant