-
Committer:
Thorbjørn Lindeijer
-
Date:
2019-01-30 14:20:15 UTC
-
Revision ID:
git-v1:b11f7cda90dc573dd3730aa48063473b06aa3a07
Scripting: Added mechanism for modifying tile layers
To avoid excessive creation of undo commands and emitting of signals,
edits to tile layers have to go through a dedicated "edit object", and
need to be explicitly applied when done.
This change enables the following example function:
function fillFirstLayerWithFirstTile() {
var tileLayer = tiled.activeAsset.layerAt(0)
var tile = tileLayer.tileAt(0, 0)
var e = tileLayer.edit()
for (var y = 0; y < tileLayer.height; y++)
for (var x = 0; x < tileLayer.width; x++)
e.setTile(x, y, tile)
e.apply()
}