joel
(Verdonck)
September 9, 2019, 8:47am
1
Hello,
In my tileSet, I’ve put a boolean collision attribute, I’m busy to write an exporter in Python based on the example given in the Tiled documentation, but impossible to get this value from the cell or wathever object available.
Is there a specific method into the cell or tileset object ?
thanks
Joël
bjorn
(Thorbjørn Lindeijer)
September 9, 2019, 9:08am
2
Hey @joel , welcome to the Tiled forum!
The following methods should be available on everything that can hold custom properties:
cls_object = tiled.add_class('Object')
cls_object.add_method('properties', retval('Tiled::Properties','p'), [])
cls_object.add_method('propertyAsString', 'QString', [('QString','prop')])
cls_object.add_method('setProperty', None,
[('QString','prop'),('QString','val')])
cls_object.add_method('setProperty', None,
[('QString','prop'),('int','val')])
cls_object.add_method('setProperty', None,
[('QString','prop'),('bool','val')])
cls_object.add_method('propertyType', 'QString', [('QString','prop')])
To get the properties of a cell you first need to get its tile or tileset:
cls_cell.add_method('tile', retval('Tiled::Tile*',reference_existing_object=True), [])
cls_cell.add_method('tileset', retval('Tiled::Tileset*',reference_existing_object=True), [])
joel
(Verdonck)
September 9, 2019, 8:16pm
3
Thank you very much for the quick answer, it’s actually working fine now thanks to you.
Tiled is really impressive, I’m amazed by the work done.
1 Like