More Scriptable Development Snapshot


This month Tiled development had a slow start as I was spending the first two weeks on renovation work. I cought up in the third week and ended up making a few big steps towards a scriptable Tiled. I also managed to squeeze in some fixes and improvements for the recent Tiled 1.2.2 release.

Objects List in Tile Collision Editor

Actually the first thing I worked on this month wasn't scripting-related. It was a priority request from a patron to add the list of objects to the Tile Collision Editor. They sometimes had a lot of objects on a tile, in which case having the list helps a lot.


The list can be hidden (default) or shown on the right or at the bottom.

Script Custom Map Export Formats

Initial support was added for defining export formats in JavaScript. Currently this works only for maps, and only to text-based formats, but that can already be quite useful. The easiest format to export to is of course JSON, but you can always put together the string manually. You can find an example in the documentation.

Access and Modify Custom Properties

Being able to associate custom properties to all data types is part of what makes Tiled so versatile. So I think it's noteworthy that they can now also be inspected and changed from scripts!

Create Stuff from Scripts

In the last snapshot, scripts were limited to changing around existing objects. Now they can create objects, layers and even maps and tilesets (though you can't do anything useful yet with the latter two).

Modify Tile Layers

Support was added for accessing the tiles in a tileset and the tiles on a tile layer. Last but not least, those tiles can now be used to modify tile layers! For performance reasons, tile layers edits are done through an "edit object". This is illustrated by the following example:

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()
}

Check out the documentation for more information. Of course the class will be expanded with more functionality in the future.

Changelog

Here is the full list of noteworthy changes since the last development snapshot.

  • Tile Collision Editor: Added objects list
  • Added 'json1' plugin that exports to the old JSON format (#2058)
  • Scripting: Added support for map export formats
  • Scripting: Added access to the custom properties
  • Scripting: Allow creating new stuff from scripts
  • Scripting: Added preliminary access to tiles in a tileset
  • Scripting: Added mechanism for modifying tile layers
  • Fixed Templates view missing from the Views menu (#2054)
  • Fixed updating of modified indicator on open file tabs
  • Fixed remembering of last used export filter
  • Fixed Copy Path / Open Folder actions for embedded tilesets (#2059)
  • Fixed truncated text in case of '<' characters in Console window
  • CSV plugin: Fixed exporting of nested tile layers
  • Linux: Updated to Qt 5.9.7 and Python 3.5
  • macOS: Updated to Qt 5.9.7 (now requires at least macOS 10.10!)

A big thanks to everybody who's making it possible for me to spend time on a big feature like the support for scripting! Thanks to your purchases and support on Patreon and Liberapay I'm able to keep spending two full days/week on Tiled development!

Files

Tiled for Windows (32-bit), snapshot 22 MB
Version 2019.01.30 Jan 30, 2019
Tiled for Windows 64-bit (snapshot) 24 MB
Version 2019.01.30 Jan 30, 2019
Tiled for Windows XP (snapshot) 19 MB
Version 2019.01.30 Jan 30, 2019
Tiled for macOS (snapshot) 15 MB
Version 2019.01.30 Jan 30, 2019
Tiled for Linux (snapshot) 35 MB
Version 2019.01.30 Jan 30, 2019

Get Tiled Map Editor

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.