The custom Python script feature sounds like exactly what I need, but I can’t get it to work.
I’m running Tiled 1.1.6 on Ubuntu 16.04. I have Python 3.4 installed (but also 3.5 and 2.7, if that matters - my python executable points to 2.7, and python3 to 3.5.) I’ve placed the example Python script from the docs in ~/.tiled/example.py. When I choose export, the example format doesn’t appear in the dropdown, and nothing shows in the debug console.
Maybe the python plugin is missing or disabled.
Look at the Plugins tab in the preferences (menu Edit > Preferences…), check if libpython.so exists and if the box is checked.
It seems this doesn’t work from the snap package, and building from source didn’t immediately work either - I had to update src/plugins/python/find_python.pri and change “python3” to “python-3.4”, then everything worked correctly.
Yeah, I’m not sure yet how to make this work. I may need to ship a complete Python runtime in the snap package, but that seems a little much. I tried shipping just the plugin, but it was unable to find platform libraries so it probably doesn’t work to rely on a system-installed Python (which likely also means that system-installed Python libraries will be unavailable, though I’m not sure about this).
The “qmake” build option is somewhat deprecated (I use the qmake project only to update the translations myself). I think it would have worked out-of-the-box using Qbs.
Not sure why that change was needed though, since Tiled should compile against any Python 3.5 as well. Maybe you were missing the python3-dev package, which provides the “python3” pkg-config file?
You’re right, installing python3-dev works as well. Probably worth calling out in the instructions, since they currently only mention installing Python 3.4, which I did have.
Just my two cents - I don’t think it’s a little much at all (Python is quite small) and I’d actually prefer Tiled ship its own Python environment over trying to use the system environment (which might inexplicably fail at runtime if I have 3.3 installed, etc.) It would certainly make the setup process easier and more consistent.
The Python plugin feature is awesome! I’m now happily using it to export my map in a custom binary format.
I finally put some time in the README, mentioning Python as well as replacing the qmake instructions with qbs:
I’m not entirely opposed to the idea of shipping Python, but it would complicate packaging on all platforms. Minor dependency additions like the recently added zstd are already a pain to get right, so this is certainly something I’d welcome help with.