Problem using Tiled and TexturePacker

I am using TexturePacker to pack my sprites into a spritesheet.
I then use this spritesheet in Tiled to create my map.

However, when I add a sprite to my spritesheet in TexturePacker and then press Ctrl+T in Tiled to update the spritesheet, all the tiles have wrong id’s because the order of tiles on the sheet might have changed.

I know that this is logical but I cannot figure out how to solve this issue without writting a new tile map editor myself which would then read the TexturePacker Xml data.

The only possibility I saw is to use “Collection of Images” then use the source string to look up the tile in the TexturePacker xml in my framework. However, this imposes some ugly rules for me to follow:

  1. I have the name but I still dont know on what spritesheet this tile is on, so I need to give the tileset the exact same name as the name of my spritesheet (including extension)
  2. I must always place the TMX in the same folder as the spritesheet (since I cannot specify a relative path in tiled)

Does anyone have a suggestion on how to deal with this?

This is a matter of maintaining a simple static index mapping file names to their respective texture atlas. Usually it’s something you are doing already anyway when using texture packing.

I don’t understand this requirement. Surely you can modify the relative path as needed to allow for the texture lookup?

See also this discussion:

Oh you mean, I iterate through all the xml files from TexturePacker and look if my tile is in there and then I have all the info I need from that xml.

That could actually work I didnt think of that.