Interitance hierarchy of Custom Properties

Hi,

does interitance hierarchy of Custom Properties in Tiled look like on schema below?

Custom Properties from Properties View  (the highest level)
         |
         |
Tile Properties
         |
         |
Predefined Properties     (the lowest level)

Properties defined on higher level overwrite properties on lower level.

Have a nice day :slight_smile:

ldurniat

Will someone answer my question??

Sorry, but if I don’t answer directly it’s either because I’m busy (I was on holiday for a few days) or because it’s a little complicated (or both, like in this case).

I don’t like things to be complicated, but unfortunately it turned out roughly this way:

inheritance

Here we see that a map object will inherit properties from its template (when it’s a template instance), it’s tile (when it’s a tile object) and it’s type (when it has a predefined type). It’s like multiple-inheritance, just that in the case of the same property being defined multiple times, the first one wins.

For tiles it’s a little easier, since it can only inherit properties based on its type.

Warning: The properties inherited by the tile based on its type are not necessarily inherited by a tile object using that tile. This happens when the tile object overrides the type, in which case only the properties of the overridden type are inherited. The same happens to properties inherited from the tile when an object template is a tile object, and the template instance overrides the tile.

Feedback is welcome, especially in regards to potential simplifications to this system.

What you mean by saying “the first one wins”?

I meant when the same property is present in the ObjectTemplate, Tile or ObjectTypes, the value of the first occurrence is taken. “First” in this case was when reading left to right.