mapeditor / mapeditor/tiled

Scripting API: Missing tileset "firstGID" property, and flip flag values don't match

Open
#3,189 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
C++
Stars
12.9k
Forks
2k
Avg merge
4h 27m
Merged PRs (30d)
8

Description

I'm trying to sort out the conversion to and from tile IDs and GIDs, but the scripting API seems designed to prevent that.

__First GID__
Documentation, issues, and forum posts all mention how to use the tileset's "first GID". It's easy, it makes sense, you just add and subtract. However, in the scripting API, tilesets are missing the firstGID property, instead they have "nextTileID" - the tile index after the last one used—in other words, the _next_ tileset's firstGID...???

__Flag Bits__
It's the same with the flag bits, all the information you can find says that the flags for flipped/rotated tiles use the _highest_ four bits (for obvious reasons, so they don't intersect with local tile ID numbers), but the [flag variables](https://www.mapeditor.org/docs/scripting/classes/tile.html#flippedantidiagonally) that are part of the scripting API use the _lowest_ four bits.

I'm sure there must be reasons for this, but for me it's just adding hours of frustration for no reason. The scripting API seems to provide the _exact opposite_ of what I want (and what the docs say you need). Possibly the solution is just to improve the documentation. Quite a lot of information that you need to import and export to and from Tiled (and for scripting in general) is missing or just very hard to find.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the scripting API documentation for tilesets and tiles, especially nextTileID and the linked flippedAntidiagonally flag variables. Compare those descriptions with the documented first GID and highest-bit flip flags, then clarify the intended conversion and representation so the API and documentation agree.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation, tooling
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.