Custom tools from plugins


(Pavel Alexandrov) #1

Yes, I know plugins currently just for read/write of custom formats, but I think such things would work better with plugin system instead of scripts.
Motivation:
While Tiled already have very impressive toolkit, sometimes there is a need for very engine-specific features. My objects have “wiring” system built-in for interactions, and currently my approach is to add property to output object stating which object he have to create connection to. That’s inconvenient in many ways. For instance I have to name every single object that I establish wiring to and when I want to check if wiring is correct - I can’t just look at the grid from editor.
I had an idea of making custom plugin that would add special tool where I can edit wires visually and always see what goes where. Sadly I found no way of doing that. This is very engine-specific tool, but being able to actually create plugins that add new functionality to the editor would be very useful for a lot of people I believe.
Suggestion:
Add ability to create new tools via plugins or scripts.
Required functionality would be:

  1. Being able to render custom data in editor map view and obviously access to interactions from user.
  2. Have access to map data. Preferably even being able to create custom property structures that have their own XML exported node…
  3. Have access to events like object/layer creation/deletion.

(Thorbjørn Lindeijer) #2

Scriptable extensions are definitely planned. It is tracked by the following issue:

The current plugin system is largely unsuitable for custom additions, even for adding import/export formats. This is because they require binary compatibility (usually means they need to be compiled for the same platform, with the same compiler and the same Qt version as Tiled), which essentially means you’re already compiling Tiled yourself at which point you can just add your tool to its C++ code. The only benefit of having the file formats in plugins is that they can be entirely disabled.

Of course, a C++ plugin would be the only way to expose the full functionality of the QGraphicsView and QPainter to the tool developer, though in the interest of future compatibility and comfort it may anyway be a better idea to provide an API in between.

Regarding your particular tool request, it’s actually a common request and tracked by the following issue:

https://github.com/bjorn/tiled/issues/707

I had hoped to work on this sooner, but at the moment I have very little time for new projects since I’m mostly busy mentoring the three GSoC students working on Tiled (who have chosen various other projects).

The latter thing is not going to happen, since it would essentially require an XML document to be represented and this could then only be supported by the TMX map format and not by the JSON or Lua formats, which currently do support all features of Tiled. However, enhancing custom properties with structures and arrays is certainly planned (#489 and #1493).


(Pavel Alexandrov) #3

Apart this issue dead for quite some time already. :​) Any news?

And again - dead for more than half-a-year. Can I expect this to be done in reasonable amount of time (let’s say - half-a-year), or I better improve on what I already have? (As much I hate idea of creating sub-editor in-game, this seems to be the best solution)

For me, that would be pretty much same solution.
Thanks for answer, and btw great tool. Spares an enourmous amount of time for programmers who need tiled map editors in their games. :slight_smile: