Hey Bjorn,
I'm currently using Tiled as my 'tileset' manager for Godot, where I make the maps in Godot and not Tiled, and it's going great. After messing around getting a good workflow between the two, I got pretty excited when I saw that there was Python scripting for export plugins, but after searching around I realised these weren't happening for tilesets, only for tilemaps.
Is this on the roadmap as per #949?
Is this actually already implemented/possible but undocumented?
Do other things need to happen for this first, such as Python 2 -> 3, and if so, how can I help with this?
Kind regards,
I'm currently using Tiled as my 'tileset' manager for Godot, where I make the maps in Godot and not Tiled, and it's going great.
I'm happy to hear you've got a good workflow going, but I'm confused about the part Tiled is playing in it as 'tileset' manager. What are you doing with Tiled exactly then? And this is something you couldn't do in Godot?
After messing around getting a good workflow between the two, I got pretty excited when I saw that there was Python scripting for export plugins, but after searching around I realised these weren't happening for tilesets, only for tilemaps.
Hmm, right, you've hit a missing feature for which no issue existed yet. It is unrelated to whether Python 2 or 3 is used and generally unrelated to whether the API is complete. There simply is no way to define a tileset format from Python currently.
In PythonPlugin::loadOrReloadModule
, it would need to be able to recognize that a Python script is in fact defining a tileset format, probably by having another class to derive from in addition to the tiled.Plugin
class. And in this case, it would need to instantiate a new PythonTilesetFormat
, which can be modeled after PythonMapFormat
(and probably share some code).
You can help by either coding or sponsoring the feature. :-)
I'm happy to hear you've got a good workflow going, but I'm confused about the part Tiled is playing in it as 'tileset' manager. What are you doing with Tiled exactly then? And this is something you couldn't do in Godot?
I find the tileset meta-information features and actions in Tiled really cool (per-tile type with custom properties, multiple-select editing). It's useable for both tilesets and spritesheets for what I'm working on.
In PythonPlugin::loadOrReloadModule, it would need to be able to recognize that a Python script is in fact defining a tileset format, probably by having another class to derive from in addition to the tiled.Plugin class. And in this case, it would need to instantiate a new PythonTilesetFormat, which can be modeled after PythonMapFormat (and probably share some code).
Looking around in the source for some way to differentiate between the maps and tilesets during the experiments, I was fearing this would be the case :D. I'll short-term fix with a converter script for now, but I'd love to contribute this feature in time. Thanks for setting me on my way!
@bjorn I would like to try to add this. It seems almost all the code for both PythonMapFormat and PythonTilesetFormat would be same. Is that the case?
@harindu95 Yes, so you should probably look into creating some helper functions to share the code.
@bjorn is there a logfile or something to view the error messages from plugin loading?
@harindu95 If a C++ plugin fails to load, you can hover over its fail icon in _Preferences > Plugins_ to see the error message. Though in general it is not very descriptive.
For Python plugins, certain output is written to the _Debug Console_, which can be enabled from the _View > Views and Toolbars_ menu. It may include certain loading errors.
Any updates on being able to write tileset Python exporters? I'm writing a 2D C++ engine and I'm already using a Python Tiled plugin to export maps, but I'd also like to be able to use it to export tilemaps.
I've added the "help wanted" label now to signify that I'm open for this but it's not currently a priority for me to implement. I've looked into it shortly and the hints I gave in previous comments are still valid.
Note that writing custom tileset formats is now possible by writing a JavaScript extension, using tiled.registerTilesetFormat
. The new JavaScript API works cross-platform and is actively maintained, and allows for much more than just defining custom formats.