Flip value in export python script

Hi, i’ve successfully written an export plugin to Sega Master System (asm file with .dw $xxxx) but i’m stuck on flip values…

Flip values should be in the MSB bits (30 and 31) (I can see this in the TMX file),
but in my python script tileLayer.cellAt(x, y).tile().id() seems to keep only the LSB part.

What i’m missing ?

Regards

That sounds pretty exciting! :slight_smile:

Hmm, unfortunately the Python plugin API is incomplete here, and does not expose the flipping states. They are not part of the tile, but part of the cell, and the Cell class is lacking a bunch of methods in tiledbinding.py:

cls_cell = tiled.add_class('Cell')
cls_cell.add_constructor([param('Tiled::Tile*','tile',transfer_ownership=False)])
cls_cell.add_copy_constructor()
cls_cell.add_method('isEmpty', 'bool', [])
cls_cell.add_method('tile', retval('Tiled::Tile*',reference_existing_object=True), [])

If you are familiar with generating Python bindings, please feel free to make a patch. Otherwise I can look into adding the missing methods (see Cell definition in tilelayer.h).

That sounds pretty exciting! :slight_smile:

Thanks ^^

If you are familiar with generating Python bindings, please feel free to make a patch. Otherwise I can look into adding the missing methods (see Cell definition in tilelayer.h).

Unfortunately not, i’m sorry.

Alright, I’ve added access to those attributes with the following change:

Note that they are not added as functions, but should probably be accessed like tileLayer.cellAt(x,y).flippedHorizontally, etc. In case of writing a reader plugin, it should be possible to assign to them as well.

The additions will be included in a possible Tiled 1.1.6 release, and I’ll make sure to merge it to master before publishing the next development snapshot.

Excellent, thank you very much :wink: