Do you want to work on this issue?
You can request for a bounty in order to promote it!
Scripting API for templates and template references #2664
bjorn posted onGitHub
An object may be instantiated based on a template, stored in a separate file. Currently, the scripting API (#949) has no access at all to templates and also can't access or change the template reference stored in an object.
It would be expected that the scripting API:
- Can access and change the template referenced by an object
- Can reset an object or some of its properties, in case they have overridden those of the template
- Can access and modify the templates themselves
The first one could be implemented by a filename-based property. The second one could be done by introducing functions to check for and unset overriding properties.
Providing editable access to templates is tricky, due to the way this is implemented in Tiled. Each change to a template currently immediately saves it and the template is not open as a "document". The undo/redo is handled by a dummy MapDocument
that wraps the open template in the TemplatesDock
. We may need to reconsider how we handle the editing of templates before writing that part of the scripting API.