Change JSON export mode

(The Mnk) #1

Hello, I would like to modify the way in which JSON data is exported

I just want the empty tile to be -1 and each tile number to match its JSON data.

tile number 0 in JSON will also be number 0.
Currently it is number 1 and the same happens with all the others.

I want to change this, how can I do it?

(Thorbjørn Lindeijer) #2

You can change that by modifying the code in gidmapper.cpp and compiling Tiled. This will also affect the TMX files, which work with the same kind of global tile IDs. It could also affect code using the GidMapper since it assumes global tile IDs are unsigned, which can’t represent -1. And it would mess with the flags used to store tile flipping. Finally, you’d of course end up with a Tiled that is incompatible with everybody else’s version of Tiled, unless you implemented this as an option.

Probably subtracting 1 in your own code would be a whole lot easier?

(The Mnk) #3

Hi, thanks, I found a solution.
I could not subtract 1 because I use an engine and I’m not sure I can access that code.