Tiled 1.1.4 - JSON exporting problems with custom properties


#1

Hey there!

As this is my first post here, I want to thank bjørn for making Tiled, it’s a fantastic software. Now, onto my issues/questions:

Firstly, I have an object with a custom property set in the editor, but when I export it, it doesn’t show up in the json file, doesn’t matter what type I use, bool, string etc. nothing shows up. I’ve read the documentation but I can’t seem to find anything about this, is this a bug or did I miss something?

Secondly, I also have a Type set in the properties, but when i place it on the map it is greyed out in the objects view. It doesn’t show up in the json unless I click on it twice (to set the name again). Is this intended behaviour?


(Thorbjørn Lindeijer) #2

Did you set the property on the object or on its type or tile? And if you really set it on the object, is the property gone when you load this file back into Tiled after exporting?

If the type is grayed out then it’s not actually set on the selected object, but rather inherited from the tile (in case of a tile object). Explicitly setting the name, in which case it will indeed be displayed in black, counts as overriding the type of the tile and will cause this overridden type to be written to the map file.

I understand it can be useful to write out the type anyway on export, even if it’s not actually overridden. The following issue is scheduled for Tiled 1.2 and will introduce an export option for this:


#3

Thank you for taking the time to answer!

I only set these custom properties (and types) in the tileset editor, upon overriding them on the map (on the actual instance of the object) it does appear in the .json.

Both of my problems were essentially the same: I was expecting the map to automatically inherit the properties (and the type) of the objects/tiles from the tileset editor.

The confusing part for me was this:
If you set the type in the editor and place the object on the map and edit the type by simply doubleclicking and pressing enter in the object list it gets overwritten and gets exported to the json map file.
Regarding the custom properties however, doubleclicking and pressing enter is not enough, you actually have to change some characters for them to be overwritten and exporting with the map .json. Though the same can be said about types too if you try to edit them from the properties window. It just felt like odd behaviour for me.

Anyway, I consider this solved, it would be nice to have a way to automatically inherit these properties, but for the time being I can work with this. Thanks again for your work on this software.


(Thorbjørn Lindeijer) #4

Yeah, I can see how this is inconsistent with the Properties view and will fix that up.

I assume you mean the behavior in the issue I linked to, so saving this out on export. I think automatically doing this for regular saves is not a good idea, because it would mean that if you later change a property on a tile or a type, it would not affect any already placed objects, because they would have overriding values in place.


#5

Yeah, I can see why that would be problematic. Either way, I can copy/paste the objects around the map with the desired properties if i want them to show up in the map json for the time being, but I’ll look into how I can import the tileset jsons into the project I’m working on.