getting tile layer properties to be inherited by tiles/objects?

Hi Dyson - is there a small change(s) in the code you would be able to point out if I wanted to have?

* properties on the layer level get inherited by Tiles on the map (and objects also if that were possible)

* properties on a specific tile (object) would override the layer level property however

E.g. if I set a specific layer up that is going to be physics enabled, I just need to then enable this at the layer level, and I don’t have to go through each of the tiles manually adding these properties in then.  

If I’m understanding you correctly, you want tiles to inherit the properties of the layer containing the tile- but only those layer properties which the tile lacks. So if a you set a layer’s physics property to true, every tile WITHOUT a physics property would inherit that physics property from the layer. And you want Tiled Objects to behave the same way.

For tiles go to line 4469. Immediately beneath “if render then” add the following:

if map.layers[layer].properties then if not map.tilesets[tileSetIndex].tileproperties then map.tilesets[tileSetIndex].tileproperties = {} end if not map.tilesets[tileSetIndex].tileproperties[tileStr] then map.tilesets[tileSetIndex].tileproperties[tileStr] = {} end for key,value in pairs(map.layers[layer].properties) do if not map.tilesets[tileSetIndex].tileproperties[tileStr][key] then map.tilesets[tileSetIndex].tileproperties[tileStr][key] = value end end end

For Tiled Objects go to line 5116. Immediately beneath “local layer = i” add the following:

if map.layers[layer].properties then for key,value in pairs(map.layers[layer].properties) do if not object.properties[key] then object.properties[key] = value end end end

Fantastic thanks. Perhaps others would find this feature useful re next release?

If I’m understanding you correctly, you want tiles to inherit the properties of the layer containing the tile- but only those layer properties which the tile lacks. So if a you set a layer’s physics property to true, every tile WITHOUT a physics property would inherit that physics property from the layer. And you want Tiled Objects to behave the same way.

For tiles go to line 4469. Immediately beneath “if render then” add the following:

if map.layers[layer].properties then if not map.tilesets[tileSetIndex].tileproperties then map.tilesets[tileSetIndex].tileproperties = {} end if not map.tilesets[tileSetIndex].tileproperties[tileStr] then map.tilesets[tileSetIndex].tileproperties[tileStr] = {} end for key,value in pairs(map.layers[layer].properties) do if not map.tilesets[tileSetIndex].tileproperties[tileStr][key] then map.tilesets[tileSetIndex].tileproperties[tileStr][key] = value end end end

For Tiled Objects go to line 5116. Immediately beneath “local layer = i” add the following:

if map.layers[layer].properties then for key,value in pairs(map.layers[layer].properties) do if not object.properties[key] then object.properties[key] = value end end end

Fantastic thanks. Perhaps others would find this feature useful re next release?